4

I'm trying to integrate Rejuice (github page is here) to my asp.net mvc project to combine js files. I downloaded it via nuget. It successfully added references and configured web.config file.

In global asax Application_Start I configured it as below:

 OnRequest.ForJs("~/Combined.js")
 .Combine
 .FilesIn("~/Scripts/").Matching("*.js")
 .Configure();
 OnRequest.ForJs("~/Combined.css")
 .Combine
 .FilesIn("~/Style/").Matching("*.css")
 .Configure();

In master page:

<%= Rejuiced.JsFor("~/Combined.js") %>
<%= Rejuiced.CssFor("~/Combined.css")%>

Running project in release mode results in downloading all the js and css files seperately. Running the site under IIS didn't help either. Isn't it supposed to combine and download only 2 files, one for js and another for css? What can cause this problem

asked Feb 15, 2012 at 22:58

3 Answers 3

5

Make sure that debug="true" is removed from your your web.config file:

Change

<system.web>
 <compilation debug="true" targetFramework="4.0">

to

<system.web>
 <compilation debug="false" targetFramework="4.0">

It doesn't matter if you build your code in Debug or Release -- Rejuicer respects the web.config debug setting, as it should. If this is set to true, then Rejuicer will not minify and combine files. It does this so that you can debug your scripts using non-minified files when working locally.

When you push your code into Production, your web.config.release transform will run, and remove the debug="true" attribute from your web.config file, so that your files will always be minified in production scenarios.

answered Feb 19, 2012 at 11:36
2
  • Yes I have debug="true" in my web config. Unfortunatelly I already switched to combres. I wish this answer came a few days ago. Thanks anyway. Commented Feb 19, 2012 at 13:44
  • You can accomplish this without changing the compilation flag. See my answer. Commented Apr 13, 2012 at 23:34
2

I had a very similar issue that was resolved by telling Rejuicer not to do anything in debug mode. There is a different way, however, than in the accepted answer to accomplish that. There are web.config settings that control Rejuicer's behavior that are not documented (as far as I can see), but that I found by inspecting the code. Set PreventPassThroughOnDebug to "true":

<configSections>
 <section name="compactor" type="Rejuicer.Configuration.CompactorConfiguration, Rejuicer"/>
 <section name="rejuicer" type="Rejuicer.Configuration.RejuicerConfiguration, Rejuicer"/>
 </configSections>
 <compactor Cache="true" Compact="true" Combine="true"/>
 <rejuicer PreventPassThroughOnDebug="true"/> <!-- THIS IS THE KEY. SET TO "true" -->
answered Apr 13, 2012 at 23:34
0

Well I couldn't manage to make it work correctly. So I switched to combres. It started to work immediatelly as expected.

answered Feb 17, 2012 at 23:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.