GitPedia

Grunt csso

Minify CSS files with CSSO.

From t32k·Updated December 12, 2025·View on GitHub·

Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. The project is written primarily in JavaScript, distributed under the MIT License license, first published in 2012. Key topics include: csso.

Latest release: 2.2.4Version 2.2.4
November 1, 2018View Changelog →

grunt-csso Build Status Dependency Status

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 guide.

Files are compressed with csso.

Options

restructure

Type: Boolean
Default: true

You can turns structural optimizations off.

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.

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

Contributors

Showing top 8 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from t32k/grunt-csso via the GitHub API.Last fetched: 6/14/2026