Comments (3)
I created the following file in autoload directory:
asseticBundle.config.php:
{code}
array( 'instance' => array( 'assetic-configuration' => array( 'parameters' => array( 'config' => array( /* \* Enable cache */ 'cacheEnabled' => false, ``` /* * Cache dir */ 'cachePath' => __DIR__ . '/../../../data/cache', /* * Debug on (used via \Assetic\Factory\AssetFactory::setDebug) * * @optional */ 'debug' => true, /* * Defaine base URL which will prepend your resources adress. * * @example * * * @optional * @default null */ 'baseUrl' => $staticServer->getDomain(), /* * When controller name will be found in this section then fallowing assets will be loaded: * INFO: assets with names prepended by '@' are alias for specific configuration resource. */ 'controllers' => array( // when 'error' controller will be loaded then 'index' => array( '@base_css', ), ), /* * When route will be mached then following assets will be loaded: * INFO: assets with names prepended by '@' are alias for specific configuration resource. */ 'routes' => array( /* * when router 'default' will be used then this set of asset will be loaded */ 'default/wildcard' => array( '@base_css', '@base_js', ), 'default' => array( '@base_css', '@base_js', ), /* * when router 'home' will be used then this set of asset will be loaded */ 'home2' => array( '@base_css', '@base_js', ), /* * when router 'quizapp' will be used then this set of asset will be loaded */ 'quizapp' => array( '@quiz_admin_js', ), ), /* * In this configuration section, you can define which js, css, resources module have. */ 'modules' => array( /* * Application module - assets configuration */ 'application' => array( # module root path for yout css and js files 'root_path' => $staticServer->getDocRoot(), # collection od assets 'collections' => array( 'base_css' => array( 'assets' => array( # relative to 'root_path' '11/css', 'css/*.css' ), 'filters' => array(), 'options' => array(), ), 'base_js' => array( 'assets' => array( 'http://code.jquery.com/jquery-1.5.2.min.js', // global 'jQuery/plugins/*.js' // relative to 'root_path' ) ), ), ), /* * Quiz module - example configuration */ 'quiz' => array( 'root_path' => __DIR__ . '/../../modules/Quiz/assets', 'collections' => array( /* * If You want move not only CSS, files but also images relative to CSS resource * You must set option flag 'move_raw' to true. */ 'quiz_app_images' => array( 'assets' => array( 'images/*.png', 'images/*.gif', ), 'options' => array( 'move_raw' => true, ) ), 'quiz_admin_js' => array( 'assets' => array( 'js/jquery.min.js', 'http://html5shim.googlecode.com/svn/trunk/html5.js', '@twitter_bootstrap_scrollspy_js', '@twitter_bootstrap_modal_js', '@twitter_bootstrap_dropdown_js', 'js/admin.js', ), /* * If Your assets collection is using a @reference its required to defain * a output filename for this collection. * * Without it, \AsseticBundle\ViewHelperSetup can't determinate * what kind of content is't is: ie. *.js or *.css; and how to setup view helpers. */ 'options' => array( 'output' => 'quiz_admin.js' ), ), ), ), ), ), ), ), ), ), ``` ); {code} Into index.php the folowing line: $defaultListeners->getConfigListener()->addConfigGlobPath(APPLICATION_PATH . "/config/autoload/*.php"); loads the asseticBundle config. I also added these lines into my layout: doctype(); ?> headTitle(); echo $this->headMeta(); echo $this->headLink(); echo $this->headStyle(); echo $this->headScript(); ?> inlineScript(); ?>That's all.
But
echo $this->headLink(); => empty
echo $this->headStyle();=> empty
echo $this->headScript();=> empty
from zf2-assetic-module.
Fixed:
You have to modify Module::init() to manage the new zf2 sharedEvents.
pre bootstrap
/*
$events = StaticEventManager::getInstance();
$events->attach('bootstrap', 'bootstrap', array($this, 'initAssetsListener'), 200);
*/
$events = $moduleManager->events();
$sharedEvents = $events->getSharedCollections();
$sharedEvents->attach('bootstrap', 'bootstrap', array($this, 'initAssetsListener'), 200);
from zf2-assetic-module.
Thanks for info. I update init method
from zf2-assetic-module.
Related Issues (20)
- Global access to scss variables (twbs or custom) HOT 2
- php public/index.php assetic build HOT 1
- When new stable release? HOT 1
- PluginManager can load assets ?? HOT 6
- development mode HOT 7
- assets by cookie HOT 1
- Remove Closure for 'AsseticBundle\Configuration' and create a factory class instead HOT 5
- ViewHelperStrategy doesn't have way to specify css media type HOT 1
- <?= $this->headScript() ?> return nothing HOT 3
- Assetic filter without constructors cannot be configured HOT 2
- Using umask as chmod HOT 2
- Module name is ZF2-assetic-module, but only supports ZF3? HOT 2
- Using cache busting and a CDN. HOT 2
- How to make CKEDITOR work as asset
- autocleared cache HOT 1
- Using yarn instead of bower. HOT 2
- Allow merge router, controller and action configuration HOT 2
- What about support PHP 7.2?
- Add support for Symfony 4 HOT 1
- Laminas support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zf2-assetic-module.