Code Monkey home page Code Monkey logo

Comments (3)

 avatar commented on August 12, 2024

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.

 avatar commented on August 12, 2024

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.

widmogrod avatar widmogrod commented on August 12, 2024

Thanks for info. I update init method

from zf2-assetic-module.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.