Use with Zend Skeleton Application - neilime/zf-assets-bundle GitHub Wiki
This example shows how to convert Zend Skeleton Application to manage assets via AssetsBundle.
1. Install skeleton application
https://docs.zendframework.com/tutorials/getting-started/skeleton-application/
2. Update dependencies
composer update
3. Install AssetsBundle
Follow the installation instructions
4. Install needed assets filters dependencies
The skeleton application uses css and js files so we have install tedivm/jshrink & tubalmartin/cssmin :
composer require tedivm/jshrink tubalmartin/cssmin
5. Create mandatory directories
mkdir -p data/AssetsBundle/processed public/cache
module/Application/config/module.config.php
6. Edit the application module configuration file Adding the configuration fragment below:
return [
//...
'assets_bundle' => [
'assets' => [
'css' => [
'css',
],
'js' => [
'js/jquery-3.1.0.min.js',
'js/bootstrap.min.js',
],
'media' => [
'img',
'fonts',
],
]
],
//...
];
module/Application/view/layout/layout.phtml
, removing prepend function for assets:
7. Edit layout file // Remove these lines
->prependStylesheet($this->basePath() . '/css/bootstrap-responsive.min.css')
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependFile($this->basePath() . '/js/bootstrap.min.js')
->prependFile($this->basePath() . '/js/jquery.min.js')