Friday, 15 August 2014

bundling and minification - ASP.Net MVC Style Bundle Not Including Most Files -



bundling and minification - ASP.Net MVC Style Bundle Not Including Most Files -

recently, local re-create of project lost of styling. took me while figure out, of styling done in 1 file , rest minor things kendo , jquery ui.

the other, minor stuff wasn't beingness added page. thought styles had been modified developer (haven't touched project in while) testing web api stuff , not ui have wrecked , never known, tracked downwards problem: site.css file beingness included in bundle , none of other ones. tried rearranging order of css files included in bundle , include site.css.

i rebuilt project, cleared cache, etc., seeing changes. remember updating nuget packages or vs packages or lately - perchance mvc package?

my question is: did alter made happen? what's causing this?

edit: code bundleconfig.cs:

public static void registerbundles(bundlecollection bundles) { bundles.add(new stylebundle("~/content/css").include( "~/content/site.css", "~/content/themes/kendo/kendo.common.min.css", "~/content/themes/kendo/kendo.default.min.css", "~/content/themes/base/minified/jquery.ui.core.min.css", "~/content/themes/base/minified/jquery.ui.resizable.min.css", "~/content/themes/base/minified/jquery.ui.selectable.min.css", "~/content/themes/base/minified/jquery.ui.accordion.min.css", "~/content/themes/base/minified/jquery.ui.autocomplete.min.css", "~/content/themes/base/minified/jquery.ui.button.min.css", "~/content/themes/base/minified/jquery.ui.dialog.min.css", "~/content/themes/base/minified/jquery.ui.slider.min.css", "~/content/themes/base/minified/jquery.ui.tabs.min.css", "~/content/themes/base/minified/jquery.ui.datepicker.min.css", "~/content/themes/base/minified/jquery.ui.progressbar.min.css", "~/content/themes/base/minified/jquery.ui.theme.min.css")); }

code _layout.cshtml:

@styles.render("~/content/themes/base/css", "~/content/css")

by default, files names ending in ".min.css" included in release builds.

the recommended bundle configuration include non-minified .css , .js files, .min version automatically selected (if exists) in release builds, i.e. <compilation debug="false">in web.config.

you can command behavior clearing , adding ignore rules bundlecollection.ignorelist. illustration bundleconfig this:

public static class bundleconfig { public static void registerbundles(bundlecollection bundles) { configureignorelist(bundles.ignorelist); // setup bundles... } public static void configureignorelist(ignorelist ignorelist) { if (ignorelist == null) throw new argumentnullexception("ignorelist"); ignorelist.clear(); // clear list, add together new patterns. ignorelist.ignore("*.intellisense.js"); ignorelist.ignore("*-vsdoc.js"); ignorelist.ignore("*.debug.js", optimizationmode.whenenabled); // ignorelist.ignore("*.min.js", optimizationmode.whendisabled); ignorelist.ignore("*.min.css", optimizationmode.whendisabled); } }

you can explicitly enable/disable optimization setting bundletable.enableoptimizations.

asp.net-mvc bundling-and-minification

No comments:

Post a Comment