Search code examples
javascriptcssbundling-and-minificationsystem.web.optimization

What js/css files should I bundle?


I am looking into the bundling features of ASP.NET 4.0 and am just curious what rules/practices people follow when deciding which files to bundle?

Should I group things by what they are, like put all jQuery files together or is it a good idea just to bundle up all files that are used in the same place?


Solution

  • I recommend reading this tutorial on bundling and minification

    bundling and minification

    Personally, I like to have one css bundle and one js bundle per page. Each bundle will only contain the files needed for that page. Keeps the http requests and size down.