Minify CSS with CSSO.
npm install gulp-csso> Minify CSS with CSSO.
*If you have any difficulties with the output of this plugin, please use
the CSSO tracker.*
With npm do:
```
npm install gulp-csso --save-dev
`js
var gulp = require('gulp');
var csso = require('gulp-csso');
gulp.task('default', function () {
return gulp.src('./main.css')
.pipe(csso())
.pipe(gulp.dest('./out'));
});
gulp.task('development', function () {
return gulp.src('./main.css')
.pipe(csso({
restructure: false,
sourceMap: true,
debug: true
}))
.pipe(gulp.dest('./out'));
});
`
#### options
For backwards compatibility it can also be a boolean. In this case, theoptions.restructure
inverted value is set to true
(e.g. becomes {restructure: false}).
##### restructure
Type: boolean true
Default:
The default is to use structure minimization for maximum compression.
Pass false instead if you want to disable this feature.
##### sourceMap
Type: boolean
Default: depends on input file has a source map or not
Specify this to generate source map; by default a source map is generated only
if the input file has a source map. Pass true to ensure that the source mapfalse
is generated or to disable this.
Alternatively, you can enable source maps support using [gulp-sourcemaps]:
[gulp-sourcemaps]: https://github.com/floridoo/gulp-sourcemaps
`js
var gulp = require('gulp');
var csso = require('gulp-csso');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('default', function () {
return gulp.src('main.css')
.pipe(sourcemaps.init())
.pipe(csso())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./out'));
});
`
##### debug
Type: boolean false
Default:
Pass true or a positive number (greater number for more details) to get some
debugging information about the minification process.
##### usage
Type: objectnull`
Default:
Usage data for advanced optimisations (read more in the CSSO documentation).
Pull requests are welcome. If you add functionality, then please add unit tests
to cover it.
MIT © Ben Briggs