yii2 使用less代替css

添加组件
php composer.phar require --prefer-dist singrana/yii2-less "*"
修改配置文件`main.php'
'components' => [
'assetManager' => [
'converter' =>
[
'class' => \singrana\assets\Converter::className(),
],
],
],
AppAsset
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',
];
}

0 个评论

要回复文章请先登录注册