Question

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?

Was it helpful?

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.

OTHER TIPS

I think how to bundle your files can be largely subjective. The only thing I think most everyone would agree upon, is you should organize your files once you have more than just a few.

If you are working on a simple site and you only have a few JS files and one CSS file, I don't see a problem with putting them all in the same place.

Once you get multiple files I like to at least group them by type:

/lib/css
/lib/js
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top