1
Answer

how to bundle Script Files in mvc

yesubabu k

yesubabu k

7y
177
1
Dear Sir,
 
I new to Mvc4 so 
i am trying to do web application with mvc 4 & Boostrap and Angular Js 
my Question is how to budle script file and how can i recognize Which file have to bundle among boostrap , angular js , javascript  files
 
please ... 
 
Answers (1)
0
issacpal

issacpal

NA 215 19 7y
using System.Web; 
using System.Web.Optimization;
public class BundleConfig {  
   public static void RegisterBundles(BundleCollection bundles)    
 {            // create an object of ScriptBundle and         
 // specify bundle name (as virtual path) as constructor parameter     
     ScriptBundle scriptBndl = new ScriptBundle("~/bundles/bootstrap");   
       //use Include() method to add all the script files with their paths 
         scriptBndl.Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js" );
           //Add the bundle into BundleCollection     
    bundles.Add(scriptBndl);       
   BundleTable.EnableOptimizations = true;     } }

For more refereneces:
https://www.aspsnippets.com/Articles/Using-Bundles-ScriptBundle-in-ASPNet-MVC-Razor.aspx
http://www.dotnettricks.com/learn/mvc/aspnet-mvc-4-performance-optimization-with-bundling-and-minification