Packing, caching, JS and CSS in PHP that differentiate between development and production environment Packing, caching, JS and CSS in PHP that differentiate between development and production environment php php

Packing, caching, JS and CSS in PHP that differentiate between development and production environment


Still working on exploring the best solution leveraging the resource already available.

CSS-JS-Booster and Turbine so far looks like the best starting point: http://github.com/Schepp/CSS-JS-Booster and http://turbinecss.org/

Other JS/CSS Combiners solutions and articles

Resource for JS compression and caching:

LESS compilers/tutorials/tools:

At Deployment time options:


Why don't you use a project build system to deploy your application to the production server that does just that? For PHP you might like Phing, since it would allow you to write extra plugins in PHP, that you can execute while deploying. Other options you might want to consider of you take this route are Ant and Capistrano (and there's lots of others), but these require knowledge of other languages (granted, you could start the php parser from them if you really wanted to...).


Great Question!

I've worked with a process with similar requirements, but we took somewhat of a different approach. I realise its maybe not exactly what you're after, but would still make some recommendations:

  1. Make the compression/compilation part of the shipping process.(You may already be doing this, but it wasn't clear from the above).
  2. Compress/compile it on the development servers too. It might be a hassle for debugging/testing but you want to be able ensure the production version and test versions are as similar as possible. If you have the luxury of multiple development stages, then you could possibly compress on one of them.
  3. Only do the compression/compilation if it passes some sort of quality scan (e.g. jslint)
  4. Don't combine the modules - keep them separate. The performance benefits you will gain will be so negligible, as to be almost pointless.
  5. Don't change the HTML, just change the dependant modules content.

I realise its a bit different from what you were intending, but in my experience it leads to a more robust development promotion model.