Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

Combine your JS & CSS files for faster loading

Added 3 Mar 2009

With the relatively recent publication of YSlow, it brought to my attention that while seperating your CSS and JS files into seperate files for a more structured application - it can greatly reduce the load time for your users. This solution aims to solve that by keeping your files seperate, and implementing the advantages of cake so ultimately your users will only have to download one aggregated JS and CSS file.
What this basically does is render the views as normal and keeps a track of all the JS and CSS files that have been requested during rendering views. When the layout is rendered we generate a URL which tells our CSS.php or our JS.php what files need to be put together and presented to the user for download.