3

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.

Mike Davis
  • 293
  • 5
  • 12
  • 1
    You should be getting un-minified while running debug mode. – Jasen Mar 12 '13 at 22:47
  • Sorry to hear that my answer didn't help. Did a bit more digging and came across this: http://stackoverflow.com/questions/13743703/async-loading-of-javascript-files-using-mvc4-bundling-and-html5-async-attribute. – Kittoes0124 Mar 12 '13 at 23:35

0 Answers0