postcss-color-tokenizer
v0.0.2
Published
PostCSS plugin to convert css colours into variables for SCSS
Downloads
2
Maintainers
Readme
PostCSS Color Tokenizer
PostCSS plugin to convert colour values into variables.
Alpha release; does not output new SCSS variables to a stylesheet at present.
.foo {
color: black;
background: #fff;
border: 2px solid rgb(0 0 0);
}
.foo {
color: $color_0;
background: $color_1;
border: 2px solid $color_0;
}
Usage
Step 1: Install plugin:
npm install --save-dev postcss postcss-color-tokenizer
Step 2: Check your project for an existing 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-color-tokenizer'),
require('autoprefixer')
]
}