/postcss-flex-item

PostCSS plugin separate the flex child element style into a selector

Primary LanguageJavaScriptMIT LicenseMIT

PostCSS Flex Item

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

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

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

Options

{
  suffix: 'Flex'; // 子元素样式后缀
}

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', { suffix: 'Flex' }),
    require('autoprefixer')
  ]
}