Giter Site home page Giter Site logo

gulp-csso's Introduction

gulp-csso Build Status NPM version Dependency Status

Minify CSS with CSSO.

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

Install

With npm do:

npm install gulp-csso --save-dev

Example

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'));
});

API

csso([options])

options

For backwards compatibility it can also be a boolean. In this case, the inverted value is set to options.restructure (e.g. true becomes {restructure: false}).

restructure

Type: boolean
Default: true

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 map is generated or false to disable this.

Alternatively, you can enable source maps support using gulp-sourcemaps:

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
Default: false

Pass true or a positive number (greater number for more details) to get some debugging information about the minification process.

usage

Type: object Default: null

Usage data for advanced optimisations (read more in the CSSO documentation).

Contributing

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

License

MIT © Ben Briggs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.