As far as I can tell (because frankly documentation on System.Web.Optimization
is very sparse), the way bundling works in ASP.NET is that you register a set of files (Javascript or CSS, corresponding with ScriptBundle
and StyleBundle
), and associate them with a virtual path; for example, ~/bundles/jqueryui
for all the jQuery UI scripts. Later, ASP.NET can minify these files when you're running in non-debug mode, and the minified version will be made available at the virtual path you specified for the bundle.
The default bundle setup registers some script bundles with ~/bundles/...
as the virtual path, and some CSS with ~/Content/css
as the virtual path. My question is, isn't this inconsistent? Wouldn't it make more sense to have something like ~/bundles/js/...
and ~/bundles/css/...
? In fact, the ~/Content
directory actually exists as a real directory, so there's even the chance of a name collision. I'd have thought you'd want your virtual bundle paths to be directories that don't exist by default, and are not meant to be created on the actual filesystem. Is there some reason why ~/Content/css
is used for the CSS bundle virtual paths that I'm not understanding?
~/Content/cssBundles
and~/Content/jsBundles
though. – Kitts