I’ve got some problems with using different less files for showing different styles in different areas of one application. With client side mode I used this code in the header of protected/views/layouts/main.php:
Yii::app()->less->files = array('less/instance.less'=>'css/instance.less');
Yii::app()->less->register();
Now I changed to server side mode and can’t get it to work. With the code from client side mode it didn’t work so I changed to only register less in the layouts/main.php’s header. I also tried to use multiple instances of the compiler but this seems not to work too. The code therefore looked like that:
'lessArea1'=>array(
'class'=>'ext.less.components.Less',
'mode'=>'server',
'files'=>array(
'less/area1.less'=>'css/area1.less',
'less/styles.less'=>'css/styles.less',
),
'options'=>array(
'nodePath'=>'/my/path/to.js',
'compilerPath'=>'/my/path/to/lessc',
'strictImports'=>true,
'forceCompile'=>true,
),
),
'lessArea2'=>array(
'class'=>'ext.less.components.Less',
'mode'=>'server',
'files'=>array(
'less/area2.less'=>'css/area2.less',
'less/styles.less'=>'css/styles.less',
),
'options'=>array(
'nodePath'=>'/my/path/to.js',
'compilerPath'=>'/my/path/to/lessc',
'strictImports'=>true,
'forceCompile'=>true,
),
),
And of course I changed the register code to register lessArea1 and lessArea2. But it was always the same, I had always the same style in both areas.
Compiling less files manually with lessc works perfectly…
Does anyone have an idea what I’m doing wrong or an hint how I could do this better?