Skip to content

Latest commit

 

History

History
162 lines (115 loc) · 6.58 KB

README.mdown

File metadata and controls

162 lines (115 loc) · 6.58 KB

Asset Compress

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

Features

  • 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.

Installing

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

Documentation for AssetCompress is available on the github wiki pages

Issues

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

License

Asset Compress is offered under an MIT license.

Copyright

2010-2012 Mark Story (http://mark-story.com)

Authors

See the github contributors list

Changelog

0.7

Other changes:

  • Import paths are now set for the less filter.
  • ROOT/ no longer needs // to work correctly.
  • paths[] can now contain remote URL's allowing you to create build files using assets on CDN's or other remote hosts.

0.6

Backwards Incompatible Changes:

  • baseUrl now 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 baseUrl will need to include the directory names as well.
  • Removed General.writeCache. It made for more complex deployments. Instead General.alwaysEnableController has been added to allow the controller to be used in production instead of pre-generated static files. The default value is off.

Other changes:

  • Support for CakePHP 2.0.
  • Added TimestampImage filter 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.
  • Added ROOT/ path variable for use in configuration files.
  • Added ScssFilter
  • Added support for plugin asset Using the p:PluginName:resource.xx syntax.

0.5

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.
  • The General.timestampFile config option was removed. Timestamp files are always used now.

Other changes

  • 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.js you can just use library.js as the build name.
  • Controller/view javascript files are now combined into minified asset automatically now.
  • 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 -force option.
  • If you don't define the paths[] keys 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 = true in 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.

0.4

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.

0.3

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.

0.2

  • 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.