Skip to content

Installation

Emilien Escalle edited this page Jan 8, 2019 · 3 revisions

Setup

Install dependencies

$ composer require neilime/zf-assets-bundle

Now install needed assets filters dependencies (none are required by default)

  • Js : composer require tedivm/jshrink (default) or composer require mrclay/jsmin-php
  • Css : composer require tubalmartin/cssmin
  • Less : composer require oyejorge/less.php tubalmartin/cssmin (default) or composer require neilime/lessphp tubalmartin/cssmin
  • Scss : composer require leafo/scssphp tubalmartin/cssmin

Post installation

  1. Enabling it in your application.config.php file.

    <?php
    return array(
        'modules' => array(
            // ...
       'AssetsBundle',
           'Zend\Mvc\Console',
            // ...
        ),
        // ...
    );

You should note that as the ordering of modules matters, you should declare the 'AssetsBundle' module before your application modules to ensure the default settings don't take priority.

  1. Insert css & js files into your layout page

    Into the <head> part :

    echo $this->headScript();

    At the bottom of the <body> part :

    echo $this->inlineScript();
Clone this wiki locally