title: How to minify single JS file in asp.net MVC
body: <p>I have ASP.NET MVC application and files that are used across all CSHTML files (like jQuery, Bootstrap, Kendo JS, CSS and my own common JS file) are bundled and referenced in _Layout.cshtml.   </p>
  
  <p>The application have several views, partial views and most of the CSHTML have reference to their own individual JS file. How do i minify these individual files? ofcourse in debug mode i would like to use non minified file.</p>
  
  <p>Should i create bundle of single file and reference it in CSHTML?<br>
  Or is there VS addon that will create minified files during development only and then in CSHTML i can do something like</p>
  
  <pre><code>#if DEBUG
   &lt;script src="~/Areas/Users/Scripts/Users/main.js"&gt;&lt;/script&gt;
  #else
   &lt;script src="~/Areas/Users/Scripts/Users/main.min.js"&gt;&lt;/script&gt;
  #endif
  </code></pre>
  
  <p>Is there any other option?</p>
  
  <p>Comments:
  This question is not duplicate. Question is about <code>HOW</code> to minify single JS, it is not asking whats the <code>Value</code> of adding single JS.</p>