Sampath Sampath - 1 year ago 86
AngularJS Question

Minification JS file on each and every *.cshtml page

The app I'm working on has been developed by using MVC and AngularJs. It's not a SPA app.I need to do bundling and minification of my JS files.I know how to do it on "Layout page".For that I have used this Bundling and Minification tutorial.

But My question is how can I Minification my JS file on each and every *.cshtml page ? And I need that JS file as unminified when I do the debug.Can I achieve that ? Any help would be highly appreciated.

Here is my "index.cshtml" page with JS file resides on bottom of the page.I would like to do Minification this js file.

//removed html code for clarity
<script type="text/javascript" src="/Resources/js/controllers/MyTestController.js"> </script>

Answer Source

Add a new ScriptBundle in BundleConfig.cs

bundles.Add(new ScriptBundle("~/bundles/yourFile").Include(
  "..." // your file(s)

and in you view

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download