PHPackages                             rhysr/zf2assetic - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. rhysr/zf2assetic

AbandonedLibrary[Framework](/categories/framework)

rhysr/zf2assetic
================

Assetic module for Zend Framework 2

041[2 issues](https://github.com/rhysr/ZF2Assetic/issues)PHP

Since Jun 6Pushed 13y ago2 watchersCompare

[ Source](https://github.com/rhysr/ZF2Assetic)[ Packagist](https://packagist.org/packages/rhysr/zf2assetic)[ RSS](/packages/rhysr-zf2assetic/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

ZF2Assetic
==========

[](#zf2assetic)

Assetic module for Zend Framework 2

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

Config
------

[](#config)

all config lives in the zf2\_assetic array

```
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

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

Precompiling assets
-------------------

[](#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

```
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.

View helper
-----------

[](#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.

```
