neilime / zf2-assets-bundle

AssetsBundle is a module for Zend Framework 2 allowing asset managment (bundling & caching)
https://neilime.github.io/zf2-assets-bundle/
MIT License
33 stars 20 forks source link

Is it possible to configure AssetsBundle to manage module specific assets? [question] #21

Closed roman-kyrii closed 10 years ago

roman-kyrii commented 10 years ago

Hello

Is it possible to define per module configuration in way that AssetsBundle would take assets from module specific folder and cache them in public/cache. For example let's say module Application has assets folder with css, js, img, fonts folders in it. How should one configure 'zf2-assets-bundle' to make it take assets from this assetsfolder. I thought it is possible by configuring Application/config/module.config.php with

...
'asset_bundle' => array(
    'assetsPath' => 'assets',

    'assets' => array(
    // 'Application' module assets...
...

but it isn't working this way.

Is this module can provide this functionality? Or assets from all modules should be placed in one folder which is pointed by 'assetsPath' configuration option?

neilime commented 10 years ago

As explain in the README (https://github.com/neilime/zf2-assets-bundle#2-assets), you can define assets configuration by module.

Exemple :

Structure

- modules
--- Application
------ assets
---------- css
---------- js
------ config
--------- module.config.php
------ src

You module.config.php can contains this following config

return array(
    //...
    'asset_bundle' => array(
         //...
         'assets' => array(
              'Application' => array(
                   'js' => array(__DIR__.'/../assets/js'),
                   'css' => array(__DIR__.'/../assets/css')
              )
         )
    )
    //...
)
roman-kyrii commented 10 years ago

Thank you very much for reply! You helped a lot. "DIR" made things work. Pardon my inattention.

neilime commented 10 years ago

I'm happy that this module helps you, thank you fo your feedback