Gulp-style-extract is a Gulp version of style-extract, which is used for extracting only specific CSS properties and their selectors from CSS files.
npm install gulp-style-extract
- properties: an array of CSS properties, that will be extracted
var gulp = require('gulp'),
extract = require('gulp-style-extract');
gulp.task('extract', function() {
gulp.src('lib/style.css')
.pipe(extract({
properties: ['color', 'background-color']
}))
.pipe(gulp.dest('dist'))
});
gulp.task('default', ['extract']);
/* Foo */
.foo {
background-color: #fff;
color: #000;
display: block;
font-size: 12px;
}
/* Bar */
.bar {
text-align: center;
}
.foo {
background-color: #fff;
color: #000;
}
The Grunt version can be found at grunt-style-extract.
The Node version can be found at style-extract.