Reindent and reformat CSS
npm install gulp-cssbeautify> CSS Beautify automatically formats your style to be consistent and easy to read
Given the following style:
``css`
.menu{color:red} .navigation{background-color:#333}
CSS Beautify will produce:
`css
.menu {
color: red
}
.navigation {
background-color: #333
}
`
Install with npm
``
npm install --save-dev gulp-cssbeautify
`js
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:
`js
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/'));
});
`
#### options.indent
Type: String
Default: ' '
Spaces to use for indentation.
#### options.openbrace
Type: String end-of-line
Default: end-of-line
Values: , separate-line
Defines the placement of open curly brace.
#### options.autosemicolon
Type: Boolean false`
Default:
Always inserts a semicolon after the last ruleset.
MIT © Jonathan Kemp