GithubHelp home page GithubHelp logo

grunt-recess's Introduction

grunt-recess

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.

Modified for Grunt v0.4.0rc5

I've edited the recess-task to use the new filesSrc and files.dist to avoid errors (the recess-task seems to fail with Grunt rc5 (confirmation needed)).

Getting Started

Requires grunt 0.4

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-recess

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-recess');

Documentation

This grunt task is a multi task, which means you can specify multiple subtasks and grunt will iterate over them. The dist below is a subtask, you could e.g. create a dev subtask to handle stuff while developing.

Example usage

Lint

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

Lint and compile

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

dest 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: {
		src: [
			'src/main.css',
			'src/component.css'
		],
		dest: 'dist/combined.css',
		options: {
			compile: true
		}
	}
}

You can specify more than one src to concat the files.

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

grunt-recess's People

Contributors

sindresorhus avatar nilsel avatar proloser avatar jmreidy avatar yannickcr avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.