2017 © Pedro Peláez
 

library zf2assetic

Assetic module for Zend Framework 2

image

rhysr/zf2assetic

Assetic module for Zend Framework 2

  • Thursday, June 6, 2013
  • by Rhysr
  • Repository
  • 0 Watchers
  • 0 Stars
  • 35 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ZF2Assetic

Assetic module for Zend Framework 2, (*1)

This module generates in two ways either by creating the asset each time it is requested via the controller or by generating the asset to disc by using a script and then letting the webserver handle it, (*2)

Config

all config lives in the zf2_assetic array ``` php, (*3)

return array( 'zf2_assetic' => array( 'useAssetController' => true, //use controller for asset, false means read from disk, recommend true for dev 'assetManifestPath' => DIR . '/../data/asset-manifest.json', //path to a json file that maps the assetName to it's path on disk, generated by build script 'useCacheBuster' => true, // alter asset filename if file changes, to circumvent browser caching (optional, default: false) 'collections' => array( //array of all defined asset collections the module will provide, (*4)

       'base_css' => array(
               'root' => __DIR__ . '/../assets/', //source directory for this collection's assets
               'useCacheBuster' => false, // override the module level cache buster rule (optional)
               'assets' => array( //list of assets to be compiled into collection
                   'css/test.css',
               ),
               'filters' => array(
                   'AsseticCssRewriteFilter', //service manager name of assetic filters to apply
               ),
               'options' => array(
                   'output' => 'base.css', //public path to collection
               ),
        ),
    ),
),

);, (*5)


## Precompiling assets when useAssetController is true the assetPath view helper when generate paths to the disk based assets. Disk based assets need to be generated via the command line ``` sh php public/index.php assets dump

This will generate a json manifest file containing a map of asset collection name to path which the view helper uses. When serving compiled assets from disk Assetic is not used in anyway., (*6)

View helper

The module has two asset path helpers for generating paths. The useAssetController flag determines which view helper is created. One serves urls to the asset controller, the other gets paths from the json asset manifest., (*7)

php <link href="<?= $this->assetPath('base_css') ?>" media="screen" rel="stylesheet" type="text/css">, (*8)

TODO

  • console controller needs tests
  • factories for all the assetic filters
  • params for filter factories e.g. node binary path

The Versions

06/06 2013

dev-master

9999999-dev

Assetic module for Zend Framework 2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Rhys Roberts