Current version 0.10.0
LESS is a modest extension that compiles LESS (dynamic stylesheets) server-side. If you haven't tried LESS you should definitely give it a go, you won't be disappointed.
Since version 0.10.0 the extension uses leafo's lessphp library. The reason I changed to use this library is because it compiles the newest version of Twitter's Bootstrap (2.0.3) which the previous library didn't.
Unzip the extension to protected/extensions/less and add the following to your main config:
'preload'=>array( ..... 'less', // preload the component to allow for automatic compilation ), ..... 'components'=>array( ..... 'less'=>array( 'class'=>'ext.less.components.LessCompiler', 'forceCompile'=>false, // indicates whether to force compiling 'paths'=>array( 'less/style.less'=>'css/style.css', ), ), ),
That's it! You're ready to start writing your stylesheets in LESS and forget about CSS. If you're not familiar with LESS you can start by reading the official documentation.
Total 10 comments
and doesn't seem to work with import statements
try this less compiler for bootstrap
"Less\Exception\CompilerException:#grid > .core is undefined " Note that the file compiles fine with Winless.
The
setupis a bit misleading:Can't load ext form me. Whats wrong?
'preload'=>array ( 'less', 'log', 'bootstrap', ), 'components'=>array ( 'lessComplier'=>array( 'autoCompile'=>true, 'class'=>'ext.less.components.LessCompiler', 'paths'=>array( '/less/styles.less'=>'/css/style.css', ) ), [....]16:15:21.978339 trace system.CModule
Loading "log" application component in C:\Users\User\www\z3usproject\index.php (13)
16:15:21.983776 trace system.CModule
Loading "bootstrap" application component in C:\Users\User\www\z3usproject\index.php (13)
Could you separate the parser from your extension (put it in vendors/, just require it) and support for a "from" and a "to" path to be given, so that every less file inside the "from" path gets compiled to the corresponding "to" path?
LessCompilationBehavior was removed a while ago, in the latest version you just add 'less' to your components to be preloaded if you want to use eager loading (which was previously done by the behavior).
Which commit is 0.9.0?
Why not compile the script depending on original file changes?
Thanks for linking that project.
Leave a comment
Please login to leave your comment.