سؤال

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!

هل كانت مفيدة؟

المحلول

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());
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top