tau
tau

Reputation: 6749

JavaScript minification in .NET with YUI

I'm using a BundleCollection to combine and minify my JavaScript in a .NET MVC project. I would like to use YUI Compressor to minify instead of whatever it's currently using. The code is like this, in Global.asax:

bundles.Add(new ScriptBundle("~/bundles/out").Include("~/assets/js/*.js"));

This is combining the files alright and minifying them, but I'd like it to use YUI. Thanks!

Upvotes: 2

Views: 664

Answers (1)

Jasen
Jasen

Reputation: 14250

Do a NuGet search for YUI Compressor and you'll find packages to replace the default one.

Basically they all work the same by plugging in a new IBundleTransform implementation.

var scriptBundle = new ScriptBundle("~/bundles/js").Include("...");
scriptBundle.Transforms.Add(new YuiJsTransformer());

Upvotes: 2

Related Questions