postcss-flex-item

1.2.0 • Public • Published

PostCSS Flex Item

PostCSS plugin separate the flex child element style into a selector.

将 flex 子元素样式分为选择器。

.foo {
  color: red;
  felx: 1;
}
.foo {
  color: red;
}
.flex_foo {
  felx: 1;
}

Required

  • postcss@^7.0.0
  • postcss-loader@^3.0.0

Options

{
  prefix: 'flex_'; // 子元素样式前缀
  validSelector: function (rule.selector) { // 有效的选择器
    return true; // 返回 false 则不处理
  }
}

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-flex-item

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-flex-item', { prefix: 'flex_' }),
    require('autoprefixer')
  ]
}

Package Sidebar

Install

npm i postcss-flex-item

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

4.9 kB

Total Files

6

Last publish

Collaborators

  • noyobo