https://github.com/jonkemp/gulp-cssbeautify
Reindent and reformat CSS
https://github.com/jonkemp/gulp-cssbeautify
cssbeautify gulp-plugin
Last synced: 12 months ago
JSON representation
Reindent and reformat CSS
- Host: GitHub
- URL: https://github.com/jonkemp/gulp-cssbeautify
- Owner: jonkemp
- License: mit
- Created: 2014-01-31T20:42:45.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T18:10:24.000Z (almost 4 years ago)
- Last Synced: 2024-04-25T04:44:51.902Z (almost 2 years ago)
- Topics: cssbeautify, gulp-plugin
- Language: JavaScript
- Size: 413 KB
- Stars: 18
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [gulp](https://github.com/wearefractal/gulp)-cssbeautify  [](https://coveralls.io/github/jonkemp/gulp-cssbeautify?branch=master)
> [CSS Beautify](https://github.com/senchalabs/cssbeautify) 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
Install with [npm](https://npmjs.org/package/gulp-cssbeautify)
```
npm install --save-dev gulp-cssbeautify
```
## Example
```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/'));
});
```
## 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](http://jonkemp.com)