admin管理员组文章数量:1406951
I'm trying to integrate Rejuice (github page is here) to my asp mvc project to bine 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 bine and download only 2 files, one for js and another for css? What can cause this problem
I'm trying to integrate Rejuice (github page is here) to my asp mvc project to bine 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 bine and download only 2 files, one for js and another for css? What can cause this problem
Share Improve this question edited Feb 16, 2012 at 22:13 rovsen asked Feb 15, 2012 at 22:58 rovsenrovsen 5,0125 gold badges40 silver badges63 bronze badges3 Answers
Reset to default 5Make sure that debug="true" is removed from your your web.config file:
Change
<system.web>
<pilation debug="true" targetFramework="4.0">
to
<system.web>
<pilation 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 bine 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.
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 acplish 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="pactor" type="Rejuicer.Configuration.CompactorConfiguration, Rejuicer"/>
<section name="rejuicer" type="Rejuicer.Configuration.RejuicerConfiguration, Rejuicer"/>
</configSections>
<pactor Cache="true" Compact="true" Combine="true"/>
<rejuicer PreventPassThroughOnDebug="true"/> <!-- THIS IS THE KEY. SET TO "true" -->
Well I couldn't manage to make it work correctly. So I switched to bres. It started to work immediatelly as expected.
本文标签: Combining javascript and css files with Rejuicer in ASPNET MVCStack Overflow
版权声明:本文标题:Combining javascript and css files with Rejuicer in ASP.NET MVC - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744947124a2633850.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论