- serve from cookie-less domain
Compress .js and .css files
Again, smaller is better and with flicking the right switches in your web server you can save a lot of bandwidth and download time for your users. Since there are many web servers I won’t go into details on how to do that, but it’s fairly straight-forward on most of them. Also don’t forget to compress your HTML and any other resources you might have. This is one of those quick&simple “tricks” you can make and get a lot of benefit.
Cache .js and .css files
Serve from cookie-less domain
This means that you serve your static resources from a different domain than your web page. This could be a totally different domain or a sub domain (which is a bit trickier to set up properly). I’ve written about this here. I’ve focused on Analytics’ cookies, but the principal is the same for all cookies, even for your session cookie (do you really need to know if a user is logged in in your CSS file?). So in short: serving static resources from a cookie-less domain insures that cookies don’t get attached to requests for that resources, which leads to smaller request sizes.
So, here we are at the end of this short guide on best practises. I do apologize for not providing any concrete configuration or coding examples, the thing is that all this stuff is very specific to each environment and I can’t possibly cover all of them. You will also notice that I didn’t mention anything about how to actually include CSS&JS files in your web page. That’s a whole other topic that I’ll maybe get to in some future post.