- Development mode builder that rebuilds assets on each request.
- Command line build tool to compile static assets for deployment.
- Built-in support for LESScss, Sass and CoffeeScript, as well as several minifiers.
- Powerful and flexible filter system allowing you to add your own minifiers/pre-processors.
- Simple configuration file.
- Incremental builds that don't recompile assets when they don't need to be.
Clone or download the plugin into one of your plugin paths. Then make sure you load the plugin:
// in app/Config/bootstrap.php CakePlugin::load('AssetCompress');
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-2012 Mark Story (http://mark-story.com)
See the github contributors list
- Import paths are now set for the less filter.
ROOT/no longer needs // to work correctly.
pathscan now contain remote URL's allowing you to create build files using assets on CDN's or other remote hosts.
Backwards Incompatible Changes:
baseUrlnow only takes effect when debug = 0. Build file existence is not checked anymore. It is assumed that build files exist at the location specified in
baseUrl. Because of this
baseUrlwill need to include the directory names as well.
General.writeCache. It made for more complex deployments. Instead
General.alwaysEnableControllerhas been added to allow the controller to be used in production instead of pre-generated static files. The default value is off.
- Support for CakePHP 2.0.
TimestampImagefilter class. This filter provides the ability to timestamp background images used in CSS files. This is useful for cache busting CSS sprites or other CSS background images.
ROOT/path variable for use in configuration files.
- Added support for plugin asset Using the
Backwards Incompatible Changes
- Ini file flag General.debug was removed. Instead Configure::read('debug') is used. This means one less configuration option to manage. Use debug = 1 to test output filters.
- The timestamp file format has changed. Remember to clear all builds when upgrading.
- A number of internal API changes have been made. If you are using the internals of AssetCompress you may have to update your code.
General.timestampFileconfig option was removed. Timestamp files are always used now.
- Ini file naming for build files made simpler. Instead of having to
prefix sections with the extension you can omit the prefix. The
extension will be read off of the build file name. Instead of
js_library.jsyou can just use
library.jsas the build name.
- When using the shell, asset targets that are still fresh will be
skipped on subsequent builds. A target is fresh if the build file's
mtime is later than all of the files that go into the target. This
behavior can be ignored using the
- If you don't define the
pathskeys in your js and css extensions, AssetCompress will recursively include all paths in the standard CakePHP directories.
- Theme support has been added. When defining a build you can set
theme = truein the build definition. When the shell is run, a build will be created for every theme installed. Themes support only works for builds defined in the ini file.
- The timestamp file format has changed and contains timestamps for each build. This was required as part of the incremental builds feature.
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.
- CoffeeScript, and LESS css support added.
- Can add any additional attributes to generated link or stylesheet tags.
Backwards incompatible changes
- Auto inclusion of all build files in the
afterRender()callback was removed. You now need to manually call
- 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.
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::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.
CssMinare now built-in filters. Both require you to put their libraries in
- 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
- Files in themes should now be auto discovered.