Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
ZendFramework 2 Assets provider module
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Asset
Filter
AssetLoaderHelper.php
AssetsController.php
AssetsFactory.php
AssetsFilterManagerFactory.php
AssetsManager.php
AssetsOptions.php
AssetsResolver.php
AssetsResolverInterface.php
Module.php
README.md

README.md

Zend Framework 2 Assets module

Provide assets trought a route. All assets content is filtred and cached. Text assets like .css and .js is rendered like a regular php with PhpRenderer.

Configuration

'assets' => array(
    'paths'     => array(
        APP_PATH . '/assets'
    ),
    'filters' => array(
        'CssAsset'=>'CssCompressorFilter',
        'JsAsset'=>array(
            'JsMinFilter',
            'PackerFilter',
        )
    ),
    'cache' => 'Cache'
)

Rendered asset ( css or js )

<?php $size = 100; ?>

.box {
    width:<?php echo $size; ?>px;
}

.style {
    height:200px;
}

<?php echo $this->render("other-cssfile"); ?>

Accessing the assets

Folder path
/assets/css/style.css
/assets/css/other/box.css
/assets/js/main.js
/assets/js/jquery/plugin.js
/assets/images/pic.jpg

Url
/assets/style.css
/assets/other/box.css
/assets/main.js
/assets/jquery/plugin.js
/assets/pic.jpg
Something went wrong with that request. Please try again.