Earlier today, I packaged up AssetCompress 0.17. This release has a few noteworthy features.
Cached builds in development
Historically, in development every build file would be rebuilt on every request even if the source files did not change. While this works OK if you have a few build targets, it can get pretty slow if you have many build targets, big build targets or use a pre-processor like sass. As of 0.17, build targets will be cached until their source files change. This means you should see noticeable performance improvements when you are not changing your assets.
The cache files can be cleared using
Console/cake asset_compress.asset_compress clear like any other build output.
While AssetCompress has always been really good as converting multiple source files into a single external resource, it has not been able to inline those assets into the source page. Inlining assets is useful when you have small assets, or assets where you want to avoid the additional HTTP call for. In 0.17 you can use inline assets with
- echo $this->AssetCompress->inlineCss('layout.css');
- echo $this->AssetCompress->inlineScript('bootstrap.js');
A big thanks to ‘coryjthompson’ for contributing this feature.
Other plugin updates
In other news, I’ve also started work on AssetCompress for CakePHP 3.0 . The plugin is already in a working pre-release state, and is installable via composer. There have been a few breaking changes so far:
- Dynamic build files and all features related to them have been removed. Dynamic build files presented a few challenges around maintenance and went against my goals of creating a fast and simple way to integrate all your asset pipeline features into one plugin.
- Prefixes on build files have been removed. In previous versions if you
started a build file with
css_, these prefixes would be removed and used as the file suffix. You must now always include the file extension in the build target
As always, let me know if you run into any issues with AssetCompress by opening an issue .