Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could register your own bundles in the <em>Global.asax</em> and use the <code>NoTransform</code> class if you do not want the content to be minified. </p> <p>I personally don't want my script to be transformed at all. I just create two script directories. One with the debug script versions and one with the originally downloaded minified versions. </p> <p>The MVC 4 out of the box minifier (JsMinify) breaks jQuery 1.7.1 for Opera, so I do not want to use that one. I just put the following lines in my <em>Global.asax</em>: <code>Application_Start()</code> method:</p> <pre><code>Bundle debugScripts = new Bundle("~/DebugScripts", new NoTransform("text/javascript")); debugScripts.AddDirectory("~/Scripts/Debug", "*.js"); BundleTable.Bundles.Add(debugScripts); Bundle productionScripts = new Bundle("~/ProductionScripts", new NoTransform("text/javascript")); productionScripts.AddDirectory("~/Scripts/Minified", "*.js"); BundleTable.Bundles.Add(productionScripts); </code></pre> <p>With that in place I can simply add either one of two lines in my <code>_layouts.cshtml</code>:</p> <pre><code>&lt;script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/DebugScripts")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/ProductionScripts")" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>Of course we could get a little more funky with this in place. We could generate just one bundle and depending on the built type select what files to include.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload