-
Notifications
You must be signed in to change notification settings - Fork 20
Configuration
The default configuration is setup to run with "Application ZF2 Skeleton"
- boolean
production
: Define the application environment (development => false). Defaulttrue
. - mixed
lastModifiedTime
: (optionnal) Allows you to define an arbitrary asset's last modified time in production. Defaultnull
: last modified time is calculated for each asset. - string
basePath
: (optionnal) only needed ifcacheUrl
use@zfBaseUrl
. If undefined, \Zend\Http\PhpEnvironment\Request::getBasePath() is used. - string
cachePath
: cache directory absolute path, you can use the@zfRootPath
constant corresponding to current working directory. Default@zfRootPath/public/cache
. - string
configCachePath
: configuration cache directory absolute path, you can use the@zfRootPath
constant corresponding to current working directory. Default@zfRootPath/data/cache
. - string
assetsPath
: (optionnal) assets directory absolute path, allows you to define relative path for assets config. You can use the constant@zfRootPath
corresponding to current working directory. Default@zfRootPath/public
. - string
cacheUrl
: cache directory base url, you can use the constant@zfBaseUrl
corresponding to application base url . Default@zfBaseUrl/assets/cache/
. - array
mediaExt
: Put here all medias extensions to be cached. Defaultarray('jpg','png','gif','cur','ttf','eot','svg','woff')
. - boolean
recursiveSearch
: If you define a folder as required asset, it will search for matching assets in that folder and its subfolders. Defaultfalse
. - integer
filesPermissions
: Permissions for created files. Default0664
- integer
directoriesPermissions
: Permissions for created directories0775
You can define assets for modules / controllers / action
Exemple :
<?php
return array(
//...
'assets_bundle' => array(
//...
'assets' => array(
//Common assets included in every pages
'css' => array(), //Define css files to include
'js' => array(), //Define js files to include
'less' => array(), //Define less files to include
'media' => array(), //Define images to manage
//Modules specific assets
'Test' => => array( // "Test" is the name of the module
'css' => array(),
'js' => array(),
'less' => array(),
'media' => array(),
//Controller specific assets
'Test\Controller\Name' => array(
'css' => array(),
'js' => array(),
'less' => array(),
'media' => array(),
//Action specific assets
'ActionName'=> array(
'css' => array(),
'js' => array(),
'less' => array(),
'media' => array()
),
//...
),
//...
),
//...
)
),
//...
),
//...
);
-
For each asset, you can specify files or directories. All these elements are related to the asset path by default, but you can specify an absolute path or use the constants "@zfAssetsPath" and "@zfRootPath". If you specify a directory, all files matching the asset type (css, less, js, media) will be included.
-
You can use
.php
files as assets, there will be interpret. -
You can use url for
js
andcss
assets :<?php return array( //... 'assets_bundle' => array( //... 'assets' => array( 'js' => array('http://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools.js'), //... ) //... ) //... );
This example includes
Mootools
from Google Hosted Libraries -
You can define an inclusion order like this :
<?php return array( //... 'assets_bundle' => array( //... 'assets' => array( 'js' => array('js/firstFile.js','js'), //... ) ) //... );
This example includes the file "firstFile.js" first, and all other javascript files in the folder "js"