Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Reindent and reformat CSS
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.jshintrc
.travis.yml
LICENSE
README.md
gulpfile.js
index.js
package.json

README.md

gulp-cssbeautify Build Status

CSS Beautify automatically formats your style to be consistent and easy to read

Given the following style:

menu{color:red} navigation{background-color:#333}

CSS Beautify will produce:

menu {
    color: red
}

navigation {
    background-color: #333
}

Install

Install with npm

npm install --save-dev gulp-cssbeautify

Example

var gulp = require('gulp'),
    cssbeautify = require('gulp-cssbeautify');

gulp.task('css', function() {
    return gulp.src('./styles/*.css')
        .pipe(cssbeautify())
        .pipe(gulp.dest('./styles/'));;
});

With options:

var gulp = require('gulp'),
    cssbeautify = require('gulp-cssbeautify');

gulp.task('css', function() {
    return gulp.src('./styles/*.css')
        .pipe(cssbeautify({
            indent: '  ',
            openbrace: 'separate-line',
            autosemicolon: true
        }))
        .pipe(gulp.dest('./styles/'));;
});

API

cssbeautify(options)

options.indent

Type: String
Default: '    '

Spaces to use for indentation.

options.openbrace

Type: String
Default: end-of-line
Values: end-of-line, separate-line

Defines the placement of open curly brace.

options.autosemicolon

Type: Boolean
Default: false

Always inserts a semicolon after the last ruleset.

License

MIT © Jonathan Kemp

Something went wrong with that request. Please try again.