0

In my project we dont use iis compress , becose we use custom CompressFilterAttribute. For views works correctly. I need to compress css and js files. Someone have any ideas?

3

2 Answers 2

5

The most common approach in ASP.NET MVC is to use content bundling: http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx

Also note that in IIS you enable static and dynamic content compression separately. To compress JS and CSS you need to enable just the static compression. You would not use dynamic compression in IIS since you are doing that in code. Although if you would enable it as well, it would still work - IIS would detect when the content is already compressed from the code and not do anything else with it.

Sign up to request clarification or add additional context in comments.

2 Comments

<urlCompression doStaticCompression="true" doDynamicCompression="false"/> in my web config. but static content compress dont work for me
do you have the matching IIS module installed?
0

Boundling is great approach, you can also try tools to minification js, less, css, coffiescript, and images.

http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3 -> images http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6 -> others

Comments

Your Answer

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.