Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET minify and concatenante App_Themes CSS files

Anyone know of a good technique that minify and combine CSS files from an ASP.NET App_Themes folder before including them in the page?

like image 896
EtienneT Avatar asked Jan 24 '23 13:01

EtienneT


2 Answers

I always use StyleManager to combine and minify my CSS. It uses a .NET port of YUI Compressor under-the-hood, and adds the ability to combine stylesheets too, so it should do exactly what you need by the sounds of it.

It also adds some nice features like CSS constants, tilde (~) resolution in background-image urls, cache control, etc.

like image 146
andrew Avatar answered Jan 26 '23 22:01

andrew


Rejuicer is a great new minifier for ASP.NET that's getting a lot of buzz: http://rejuice.me

It:

  • Has a fluent interface for configuration
  • Allows you to specify files to minify with wildcard rules
  • Runs on Windows Azure
  • Somewhat magically turns itself off in development environments, so you can debug your original javascript code (not minified).

The configuration (done on ApplicationStart in global.asax.cs) is as simple as:

OnRequest.ForJs("~/Combined.js")
            .Compact
            .FilesIn("~/Scripts/")
              .Matching("*.js")
            .Configure();
like image 39
Sam Avatar answered Jan 26 '23 22:01

Sam