Performance Tuning for JS and CSS

Including CSS

For including CSS use and not @import. This is an important performance consideration. If you use @import, it does not allow parallel downloading of CSS files. Beautifully explained here. CSS files should always be included in the HEAD of the document. Again, this is important from a performance perspective. This is especially important when you consider the perceived performance of a page. With the CSS rules in place before the body element is reached the browser is able to go about the important task of rendering your markup as early as possible.

JS files should always be included near the END of a document, unless there is specific reason for importing elsewhere in the document. This is to maximize page performance. Keep the number of JS files to a minimum and avoid inline-JS (unless you know why it might be ok, don’t do it

contd… more to write