2017 © Pedro Peláez
 

lithium-library li3_assetic

Bring the power of Assetic to the Lithium Framework

image

servicerunner/li3_assetic

Bring the power of Assetic to the Lithium Framework

  • Tuesday, January 21, 2014
  • by leek
  • Repository
  • 0 Watchers
  • 2 Stars
  • 11,278 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

li3_assetic

A Lithium helper that wraps asset manager functionality from Assetic. Thanks to @mgcrea for a great starting point., (*1)

Installation

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'),
    )
));

Usage

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));

The Versions

21/01 2014

dev-master

9999999-dev https://github.com/ServiceRunner/li3_assetic

Bring the power of Assetic to the Lithium Framework

  Sources   Download

The Requires

 

asset assetic lithium li3