A gulp plugin for the CSS compressor that shows no mercy.
JavaScript CSS
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
fixtures
.editorconfig
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE-MIT
README.md
gulpfile.js
index.js
package.json
test.js

README.md

gulp-css-condense Build Status NPM version Dependency Status

A gulp plugin for the CSS compressor that shows no mercy.

If you have any difficulties with the output of this plugin, please use the css-condense tracker.

Install via npm:

npm install gulp-css-condense --save-dev

Example

var gulp = require('gulp');
var cssc = require('gulp-css-condense');

gulp.task('default', function() {
    return gulp.src('./main.css')
        .pipe(cssc())
        .pipe(gulp.dest('./out'));
});

Options

safe

Type: Boolean

If this is set to true, css-condense will not perform optimisations such as selector and declaration consolidation (the docs have more information). Note that you can also choose which optimisations that you deem to be fit for your build by passing them individually:

var gulp = require('gulp');
var cssc = require('gulp-css-condense');

gulp.task('default', function() {
    return gulp.src('./main.css')
        .pipe(cssc({
            consolidateViaDeclarations: true,
            consolidateViaSelectors: false,
            consolidateMediaQueries: true
        }))
        .pipe(gulp.dest('./out'));
});

options.safe is just a convenience for specifying all of the above options as false.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs