Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/t32k/grunt-csso
Minify CSS files with CSSO.
https://github.com/t32k/grunt-csso
csso
Last synced: about 2 months ago
JSON representation
Minify CSS files with CSSO.
- Host: GitHub
- URL: https://github.com/t32k/grunt-csso
- Owner: t32k
- License: mit
- Created: 2012-10-13T15:25:55.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-11-01T18:50:20.000Z (almost 6 years ago)
- Last Synced: 2024-07-17T19:36:31.373Z (2 months ago)
- Topics: csso
- Language: JavaScript
- Homepage: http://css.github.io/csso/
- Size: 148 KB
- Stars: 163
- Watchers: 7
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# grunt-csso [![Build Status](https://secure.travis-ci.org/t32k/grunt-csso.svg?branch=master)](http://travis-ci.org/t32k/grunt-csso) [![Dependency Status](https://david-dm.org/t32k/grunt-csso.svg)](https://david-dm.org/t32k/grunt-csso)
> Minify CSS files with CSSO.
## CSSO task
Run this task with the `grunt csso` command.
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
Files are compressed with [csso](http://css.github.io/csso/).
### Options
#### restructure
Type: `Boolean`
Default: `true`You can turns __[structural optimizations](http://bem.info/tools/optimizers/csso/description/)__ off.
#### banner
Type: `String`
Default: `null`Prefix the compressed source with the given banner, with a linebreak inbetween.
#### report
Choices: `false`, `true`, `'min'`, `'gzip'`
Default: `false`Either report only minification result or report minification and gzip results. This is useful to see exactly how well clean-css is performing but using `'gzip'` will make the task take 5-10x longer to complete. [Example output](https://github.com/sindresorhus/maxmin#readme).
#### beforeCompress
Type: `(ast, options, csso) => {}`, `[(ast, options, csso) => {}]`
Default: `null`Allows registering one or many `beforeCompress` functions. This is useful to add manipulate the AST before compression is made by csso.
#### afterCompress
Type: `(ast, options, csso) => {}`, `[(ast, options, csso) => {}]`
Default: `null`Allows registering one or many `afterCompress` functions. This is useful to add manipulate the AST after compression is made by csso.
### Usage Examples
```js
csso: {
compress: {
options: {
report: 'gzip'
},
files: {
'output.css': ['input.css']
}
},
restructure: {
options: {
restructure: false,
report: 'min'
},
files: {
'restructure.css': ['input.css']
}
},
banner: {
options: {
banner: '/* Copyleft */'
},
files: {
'banner.css': ['input.css']
}
},
shortcut: {
src: 'override.css'
}
}
```#### Minify all contents of a release directory and add a `.min.css` extension
```js
csso: {
dynamic_mappings: {
expand: true,
cwd: '/css/',
src: ['*.css', '!*.min.css'],
dest: 'dest/css/',
ext: '.min.css'
}
}
```