Recently I needed to use LESS in my Yii 1.1 project and I’ve come to a conclusion that the easiest way to achieve it is to modify CHtml::cssFile like this:
public static function cssFile($url,$media='')
{
$relation = preg_match('/\.less$/',$url) ? 'stylesheet/less' : 'stylesheet';
return CHtml::linkTag($relation,'text/css',$url,$media!=='' ? $media : null);
}
With this edit you can include LESS files through CClientScript like normal CSS files.
How do you find this approach? Do you think, this may be merged in the framework? Why not?