alfredc / grunt-recess

Lint and minify CSS and LESS

Home Page:http://sindresorhus.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grunt-recess

Requires grunt 0.4. Use version 0.1.4 for grunt 0.3 compatibility

Grunt task to lint and minify CSS and LESS, using the Twitter RECESS module:

Developed at Twitter to support our internal styleguide, RECESS is a simple, attractive code quality tool for CSS built on top of LESS.

Incorporate it into your development process as a linter, or integrate it directly into your build system as a compiler, RECESS will keep your source looking clean and super manageable.

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:

npm install grunt-recess --save-dev

Documentation

Example usage

Lint

recess: {
	dist: {
		src: ['src/main.css']
	}
}

Lint and compile

recess: {
	dist: {
		options: {
			compile: true
		},
		files: {
			'dist/main.css': ['src/main.less']
		}
	}
}

A destination is only needed when compile: true. It won't output any warnings in this mode. You can also specify .less files and they will be compiled.

Lint, compile and concat

recess: {
	dist: {
		options: {
			compile: true
		},
		files: {
			'dist/combined.css': [
				'src/main.css',
				'src/component.css'
			]
		}
	}
}

You can specify multiple source files to concat them.

Options

// Default
compile: false 				// Compiles CSS or LESS. Fixes white space and sort order.
compress: false				// Compress your compiled code
noIDs: true					// Doesn't complain about using IDs in your stylesheets
noJSPrefix: true			// Doesn't complain about styling .js- prefixed classnames
noOverqualifying: true		// Doesn't complain about overqualified selectors (ie: div#foo.bar)
noUnderscores: true			// Doesn't complain about using underscores in your class names
noUniversalSelectors: true	// Doesn't complain about using the universal * selector
prefixWhitespace: true		// Adds whitespace prefix to line up vender prefixed properties
strictPropertyOrder: true	// Complains if not strict property order
stripColors: false			// Strip colors from the Terminal output
// ^ Deprecated. Instead pass `--no-color` to grunt
zeroUnits: true				// Doesn't complain if you add units to values of 0

Tests

Grunt currently doesn't have a way to test tasks directly. You can test this task by running grunt and check that it passes on the valid files and fails on the invalid.

Contribute

In lieu of a formal styleguide, take care to maintain the existing coding style.

License

MIT License (c) Sindre Sorhus

About

Lint and minify CSS and LESS

http://sindresorhus.com


Languages

Language:JavaScript 100.0%