servicerunner/li3_assetic
Composer 安装命令:
composer require servicerunner/li3_assetic
包简介
Bring the power of Assetic to the Lithium Framework
README 文档
README
A Lithium helper that wraps asset manager functionality from Assetic. Thanks to @mgcrea for a great starting point.
Installation
Load li3_assetic by updating config/bootstrap/libraries.php (provided with example configuration):
<?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'), ) ));
Usage
Examples of using the helper in your layout:
<?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:
<?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));
统计信息
- 总下载量: 59.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-08-27