postcss-conditionals
1.安装
# yarn add postcss-conditionals -D
2.配置(postcss.config.js)
module.exports = {
plugins: [
...,
require('postcss-simple-vars'),//->后
require('postcss-conditionals')
]
}
3.使用
例1:
$type: t1;
body {
@if $type == t1 {
color: red;
} @else if $type == t2 {
color: green;
} @else {
color: blue;
}
}