4

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?

5 Answers 5

3

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.

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

Comments

3

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();

Comments

2

Also check out RequestReduce. It combines and minifies CSS on the fly and next week's release will include javascript. It also will sprite background images as well as optimize the compresion and color palette of the images. It manages ETAG and expires headers as well. It is compatible with any IIS based web site and requires no code changes or asset reorganization. It requires little to no configuration in basic environments and also provides support for web farms and CDNs. It's OSS (Free) and is currently used on some Microsoft web sites like the Visual Studio Gallery.

Comments

1

It looks like someone worked on a similar problem here.

1 Comment

Sorry. I don't know what happened to the original link.
0

Check out the YUI Compressor.

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.