Combine, collapse and gzip for CSS and JavaScript files for ASP.NET MVC

Good afternoon!

I am looking for a solution for combining, minimizing and gzip CSS and JavaScript files. It seems they come in two forms:

  • In the form of an ASP.NET handler \ module with on-the-fly processing files (with caching results)
  • In the form of VS build tasks (to perform processing during construction)

As a rule, I'm fine too.

I reviewed a number of solutions (and I often use the ASP.NET handler from this article http://www.codeproject.com/KB/aspnet/httpcompression.aspx ), but maybe something "should have" come out, and I missed his.

Thanks in advance!

+5
source share
3 answers

: HTTP--.

JavaScript minifier ( Google Closure Minifier), , MSBUILD NANT. CSS ( Yahoo! YUI Compressor). LESS, YUI. , optipng. , .

, , , MVC. , , , :

Response.ExpiresAbsolute = DateTime.Now.AddYears(1);

, , . , . ... Google .

, .

+6
+2

Moth ( ) javascript/css . . Wiki: Javascript.

Best of all, it can also put all javascript at the bottom of the page, including the parts that you write in your partial views! Wiki: Inline script .

+2
source

All Articles