I can't find a decent answer to this question. I see there are a couple other similar questions that have been asked, but they do not provide me with decent answers.
In Visual Studio, is there a way to compress all files that should be compressed (HTML, XML, CSS) automatically when the application is published?
It seems a bit pointless and wasteful to have all the extra white space, comments, and other things on the server. I have looked for different Extensions and NuGet packages, but have been unable to find anything that provides me with a solution.
You want something like Cassette.
Cassette automatically sorts, concatenates, minifies, caches and versions all your JavaScript, CoffeeScript, CSS, LESS, Sass and HTML templates.
It's very simple to use, just read their documentation. It takes at most 5 minutes to setup.
To install, open the NuGet Package Console and type in:
Install-Package Cassette.Web
This will take care of installing, and setting things up for you.
For help or suggestion, check out their Google Group:
http://groups.google.com/group/cassette
There is also the option of using SquishIt. It works fine with MVC3 and serves the same purpose as Cassette. However, personally I prefer Cassette.
http://lostinthegc.wordpress.com/2012/01/14/using-squishit-in-an-asp-net-mvc3-web-application/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With