dev-master
9999999-dev https://github.com/ServiceRunner/li3_asseticBring the power of Assetic to the Lithium Framework
The Requires
by Contributors
by Chris Jones
asset assetic lithium li3
Bring the power of Assetic to the Lithium Framework
A Lithium helper that wraps asset manager functionality from Assetic. Thanks to @mgcrea for a great starting point., (*1)
Load li3_assetic
by updating config/bootstrap/libraries.php
(provided with example configuration):, (*2)
<?php // ... snip ... Libraries::add('li3_assetic', array( 'optimize' => Environment::is('production'), 'debug' => Environment::is('development'), 'stylesPath' => LITHIUM_APP_PATH . '/webroot/css', 'scriptsPath' => LITHIUM_APP_PATH . '/webroot/js', 'filters' => array( 'lessphp' => new Assetic\Filter\LessphpFilter(), 'yui_css' => new Assetic\Filter\Yui\CssCompressorFilter(LITHIUM_APP_PATH . '/../tools/yuicompressor-2.4.7.jar'), 'yui_js' => new Assetic\Filter\Yui\JsCompressorFilter(LITHIUM_APP_PATH . '/../tools/yuicompressor-2.4.7.jar'), ) ));
Examples of using the helper in your layout:, (*3)
<?php // Override configuration via helper (ie; top of your layout) $this->assetic->config(array('optimize' => true)); // Regular call echo $this->assetic->script(array('libs/json2', 'libs/phonegap-1.2.0', 'libs/underscore', 'libs/mustache')); // Use some filter (will be processed even in development mode) echo $this->assetic->style(array('mobile/core'), array('target' => 'mobile.css', 'filters' => array('lessphp'))); // Use glob asset (will be processed even in development mode) echo $this->assetic->script(array('php/*.js'), array('target' => 'php.js'));
Note: Make sure to end your layout with final (production only by default) configuration:, (*4)
<?php // Will not overwrite existing compiled file by default echo $this->assetic->styles(array('target' => 'mobile.css', 'filters' => 'yui_css')); // Will generated compiled output even if files exists echo $this->assetic->scripts(array('target' => 'mobile.js', 'filters' => 'yui_js', 'force' => true));
Bring the power of Assetic to the Lithium Framework
asset assetic lithium li3