添加组件PHP composer.phar require --prefer-dist singrana/yii2-less "*"
[
'assetManager' => [
'converter' =>
[
'class' => \singrana\assets\Converter::className(),],
在AppAsset
中
PHP;">
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.less',//*.less代替*.css并在css目录中使用.less后缀的,并在版本库中忽略.css文件
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset','yii\bootstrap\BootstrapAsset',];
}
这样就可以用less来写样式了
原文链接:https://www.f2er.com/php/17804.html