postcss-each

1.安装
# yarn add postcss-each -D
2.配置(postcss.config.js)
module.exports = {
  plugins: [
    ...,
    require('postcss-each'),
    require('postcss-simple-vars')//<-前

  ]
}
3.使用

例1:

@each $x in (a, b, c) {
  .a-$(x) {
    padding: $(x)px;
  }
}

例2:

@each $x, $i in (a, b, c) {
  .a-$(x) {
    padding: $(i)px;
  }
}

例3:

@each $x, $y, $i in (a, b, c), (d, e, f) {
  .a-$(x)-$(y) {
    padding: $(i)px;
  }
}

results matching ""

    No results matching ""