Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.


Stack Overflow

The old fashioned way


July 26, 2007 – 11:26am sfCombineFilterPlugin: Combine js and css requests into single compressed files

The sfCombineFilter plugin automatically combines included js and css files in your web response into one request each, passing the string of file names to a special php file that concatenates them and compresses them for faster delivery. This file is then cached for future use.

This plugin is an implementation of the CSS and Javascript Combiner by Niels Leenheer. This Symfony filter provides means to automatically combine your included javascripts and stylesheets into one request each. Then, the combine.php script takes over and the included files are combined into a single large file and compressed using gzip. The resulting file is cached and used every time that particular combination of files is used, until any of the files are changed at which point a new cache is automatically created.

As this plugin is a filter that checks for all js or css files included in the response, you don’t have to make any changes to your view.yml files. Simply turn on the filter and any or all of your external js / css resources will be automatically reduced to a single call each. When your visitors request this special file, they will get one large file, gzipped and ready to go.

We have used this on one production site without any problems, and we have noticed it increases load time considerably because of the size of external javascript files required. You can read more about the reasoning behind this on Niels’ site

View and download sfCombineFilterPlugin.

Posted in     |  delicious   |  Digg