An asset compression plugin for CakePHP
PHP JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 635 commits behind markstory:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Asset Compress

Asset Compress is CakePHP plugin for helping reduce the number of requests, and optimizing the remaining reqests your application makes for Javascript and CSS files.


  • Development mode builder that rebuilds assets on each request.
  • Command line build tool to compile static assets for deployment.
  • Built-in support for LESScss and CoffeeScript, as well as several minifiers.
  • Powerful and flexible filter system allowing you to add your own minifiers/pre-processors.
  • Simple configuration file.


Clone or download the plugin into one of your plugin paths. From there read the wiki for more information.


Documentation for AssetCompress is available on the github wiki pages


Please report any issues you have with the plugin to the issue tracker on github.


Asset Compress is offered under an MIT license.


2010-2011 Mark Story (


  • Mark Story
  • Ben McClure
  • Igor Fomin
  • Rachman Chavik
  • Sumit Madan
  • Florian Krämer
  • Frank de Graaf (Phally)
  • Alan Bount



Backwards Incompatible Changes

  • Internals of the plugin re-factored and re-architected to be simpler.
  • New configuration file format.
  • Helper method changes, creating builds on the fly now works differently.
  • Comment stripping features removed, you should use one of the built-in minifier integrations to accomplish this.
  • Sprockets features and InlineImport feature extracted into filters.
  • Helper methods changed.

Other changes

  • CoffeeScript, and LESS css support added.
  • Can add any additional attributes to generated link or stylesheet tags.


Backwards incompatible changes

  • Inflection of file names for javascript and css was removed. This affects both the helper, and the directives supported by each file type.
  • Auto inclusion of all build files in the afterRender() callback was removed. You now need to manually call includeAssets().
  • The default build file is now a magic-hash. Magic-hash build files, use the md5() of their components as the build filename. This allows you to easily create build files without worrying about keeping them unique across your application.

Other changes

  • AssetCompressHelper::includeAssets() takes an array of build files you wish to output in that call. This lets you place some build files at the top of the document, and others at the bottom.
  • AssetCompressHelper::includeJs() and AssetCompressHelper::includeCss() were added. These methods function similar to includeAssets(). Each allows you to only include some of the build files.
  • Assets that do not exist now return 404 errors.
  • Two basic filters have been added. JsMin and CssMin are now built-in filters. Both require you to put their libraries in app/vendors.
  • Filters for YUI Compressor have been added. Both a CSS and Javascript filter have been added. They require you to put yuicompressor in your app's vendors directories.
  • The asset_compress shell can now generate build files. This allows you to integrate asset generation into your deployment/build scripts.


  • Timestampping of build files was added.
  • Filters for CSS files were fixed.
  • Location for asset_compress.ini file was moved into app/config/asset_compres.ini.
  • Files in themes should now be auto discovered.