What is style-extract?
Style-extract is a Node.js script for extracting only specific CSS properties and their selectors from CSS code. We use it in our workflow to get background-color
, color
, font-size
and other CSS properties, which we want our users to change.
Install
npm install style-extract
Settings
extract(code, [options])
code
: String of the CSS code.
options
:
- properties: an array of CSS properties, that will be extracted
Usage
var extract = ;var fs = ;var css = fs;var options =properties: 'color' 'background-color';var result = ;fs;
Before
/* Foo *//* Bar */
After
Grunt version
The Grunt version can be found at grunt-style-extract.
Gulp version
The Gulp version can be found at gulp-style-extract.