Looking at the overview here: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
It looks like you can use Scripts.Url
inside a script tag in case you want to decorate the script tag:
<script src='@Scripts.Url("~/bundles/modernizr")' async> </script>
The problem is regardless of whether the program is running in debug mode, you always get the minified version.
Is there any way to get the same minified/un-minified functionality as Scripts.Render
with Scripts.Url
?
Update
It looks like you can remove transforms from each bundle to prevent it from actually minifying the bundle. So I added this after declaring each bundle:
// If optimizations aren't enabled
if (!BundleTable.EnableOptimizations)
{
// Iterate over each bundle
foreach (var b in bundles)
{
// And strip out any transformations (minify)
b.Transforms.Clear();
}
}
Not the prettiest thing, but works for now. If there is an easier way, I'd love to know.