Asset management with Zend Framework 2
Upcoming SlideShare
Loading in...5
×
 

Asset management with Zend Framework 2

on

  • 4,124 views

One of the first issues a developer runs into when dealing with ZF2 modules is how to arrange assets between modules. This presentation covers such issue. ...

One of the first issues a developer runs into when dealing with ZF2 modules is how to arrange assets between modules. This presentation covers such issue.

More can be found on this blog post: http://www.mvassociati.it/en/gems/php/asset-management-zend-framework-2

Statistics

Views

Total Views
4,124
Views on SlideShare
4,110
Embed Views
14

Actions

Likes
7
Downloads
36
Comments
0

2 Embeds 14

http://www.dev.mvassociati.it 8
https://twitter.com 6

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Asset management with Zend Framework 2 Asset management with Zend Framework 2 Presentation Transcript

  • ZF2 Asset management with AssetManager modulehttp://www.mvassociati.it/en/gems/php/asset-management-zend-framework-2
  • MODULE’S ASSETS: IMAGES/JS/CSShttp://www.flickr.com/photos/tracyleephoto/8322509672
  • Shared between modules Like javascript libraries, logos, buttons, CSS scripts and snippets, etc.3
  • Shared between modules Like javascript libraries, logos, buttons, CSS scripts and snippets, etc. Where should they be placed?4
  • Shared between modules Like javascript libraries, logos, buttons, CSS scripts and snippets, etc. Where should they be placed? Inside project /public folder? There is a better way…5
  • Exclusive of a module Like javascript libraries, images and CSS files that are needed by a single module only6
  • Exclusive of a module Like javascript libraries, images and CSS files that are needed by a single module only Where should they be placed?7
  • Exclusive of a module Like javascript libraries, images and CSS files that are needed by a single module only Where should they be placed? Inside that module!8
  • Possible approaches • Copy & paste of each file inside project /public folder? • Use symlinks? • Tune apache to "look" the files inside each module?9
  • The way to go: AssetManager10
  • AssetManagermodule Resolvers Assets Asset Filters Manager Cache11
  • AssetManagermodule Resolvers Assets Asset ManagerResolvers:allowing to define asset naming and locations12
  • AssetManagermodule Resolvers Assets Asset Filters ManagerFilters:allowing to make some processingbefore serving assets13
  • AssetManagermodule Resolvers Assets Asset Filters ManagerCache:allowing to choose Cachecaching policy14
  • Where to put module assets? all module’s assets15
  • module.config.phpreturn array( asset_manager => array( resolver_configs => array( paths => array( __DIR__ . /../assets, ),),),), ...
  • module.config.phpreturn array( asset_manager => array( resolver_configs => array( paths => array( __DIR__ . /../assets, ),),),), ... layout.php echo $this->headLink() ->prependStylesheet($this->basePath() . /css/aCssFile.css);
  • module.config.phpreturn array(asset_manager => array( resolver_configs => array( map => array( css/main.css => __DIR__./../assets/css/main.css, css/custom1.css => __DIR__./../assets/css/custom1.css, ), collections => array( css/merge.css => array( css/main.css,css/custom1.css,),),),),), ...
  • module.config.phpreturn array(asset_manager => array( resolver_configs => array( map => array( css/main.css => __DIR__./../assets/css/main.css, css/custom1.css => __DIR__./../assets/css/custom1.css, ), collections => array( css/merge.css => array( css/main.css,css/custom1.css,),),),),), ... layout.php echo $this->headLink() ->prependStylesheet($this->basePath() . /css/merge.css);
  • Stefano Valle@stefanovalles.valle@mvassociati.it