简体   繁体   中英

ASP.NET minify and concatenante App_Themes CSS files

任何人都知道一种很好的技术,可以将ASP.NET App_Themes文件夹中的CSS文件缩小并组合起来,然后再将它们包含在页面中?

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.

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

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.

看起来有人在这里遇到了类似的问题。

查看YUI Compressor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM