Plugin for autocompiling less in Zend Framework based on lessphp (http://leafo.net/lessphp/)
-
Get source code using one of options:
- download latest release Download the latest release or
- clone the repo
git://github.com/ludmanp/ZendLess.git
-
Copy folder Less to your library folder
-
Copy
LessAutoCompilePlugin.phpfrom plugins folder to your plugins folder -
In
Zend_Registryhave been registered config with namecnfcontaining'less' => array( 'development' => true, 'files' => 'list of less files separated by comma (,)', 'path' => 'path/to/less/folder/', 'formatter' => 'lessjs', // allowed "lessjs", "compressed", "classic" 'outPath' => 'path/to/css/folder/', 'css_ini' => 'path/to/css.ini', ),If you use other name for config change it in
LessAutoCompilePlugin.phpinrouteStartup -
Register in bootstrap
LessAutoCompilePlugin.phpplugin$lessAutoCompilePlugin = new LessAutoCompilePlugin(); $front->registerPlugin($lessAutoCompilePlugin); -
Register helper path
$view->addHelperPath("Less/View/Helper", "Less_View_Helper");
If less->outPath and less->css_ini folders are wratable it will work.
-
development - if false autocompilation is switched off.
-
files - coma separated list of
.lessfiles. Example:'bootstrap.less,docs.less'. -
path - path to
.lessfiles from the host root -
formatter - lessphp output formatter parameter.
lessjs(default),compressedandclassicare available. For more detailes see http://leafo.net/lessphp/docs/#output_formatting -
outPath - path where to save compiled
.cssfiles. -
css_ini - path to file for saving lessphp cached information.
Note! if this parameter is empty or not defined less compilator will work and cached info will try to save into
less->pathfolder for each.lessfile separatle with.cacheextension.
-
Autocompile
.lessfiles when changes to .less files are done. More info on http://leafo.net/lessphp/docs/#compiling_automatically (cachedCompileused) -
Puts last updated hash to
.cssfile appending by$this->view->headLink()->appendStylesheet('path/to/css/file.css');It will be appended like
<link href="path/to/css/file.css?123456" media="screen" rel="stylesheet" type="text/css" >where 123456 - last updated hash from lessphp
- For more info on lessphp see http://leafo.net/lessphp/ , full documentation http://leafo.net/lessphp/docs/
- For more information on less see http://lesscss.org/