1

I am trying to minify a css file using System.Web.Optimizations and it won't work

var fontAwsomeBundle = new Bundle("~/bundles/css/font-awsome", new CssMinify())
      .Include("~/content/packages/font-awesome/css/font-awesome-{version}.css", new CssRewriteUrlTransform());
  • I have run site with optimizations enabled and debug=false
  • There is no pre-minified file in the same location
  • .net 4.5, IIS Express
  • System.Web.Optimizations 1.1.0.0, WebGrease 1.6.5135.21930. I tried updating WebGrease to latest, but that didn't work
  • I am not getting any minification errors in the bundle file, just unminified version of file

Tried this version as well. fontAwsomeBundle.Transforms.Add(new CssMinify());

Syam
  • 1,629
  • 1
  • 20
  • 32
  • found the culprit. Some one else is clearing all the bundle transformations in a different place. – Syam Jul 18 '14 at 01:51

1 Answers1

0

You should use the StyleBundle for .css and ScriptBundle for .js.

var fontAwsomeBundle = new StyleBundle("~/bundles/css/font-awsome", new CssMinify())
      .Include("~/content/packages/font-awesome/css/font-awesome-{version}.css", new CssRewriteUrlTransform());
Ross Bush
  • 14,648
  • 2
  • 32
  • 55