grunt-stylus

Please use grunt-contrib-stylus.

Stylus task for Grunt.

npm install grunt-stylus
2 downloads in the last day
8 downloads in the last week
45 downloads in the last month

Stylus task for Grunt

Warning

This plugin is deprecated. Use grunt-contrib-stylus with Grunt 0.4. It’s more awesome and it should work fine as a drop-in replacement for grunt-stylus.

Installation

Install grunt-stylus:

npm install grunt-stylus

Add somewhere in your grunt.js:

grunt.loadNpmTasks('grunt-stylus');

Inside your grunt.js file add a section named stylus. See Parameters section below for details.

Parameters

files object

Defines what files this task will process and should contain key:value pairs. The key should result CSS files and the value should be a source Stylus filepath. Supports grunt.template.

options object

Controls how this task (and its helpers) operate and should contain key:value pairs, see Options section below.

Options

paths string|array

Specifies directories to scan for @import directives when parsing.

Notes

  • You can specify all other Stylus options you need: eg. include css.

  • Options compress is enabled by default. See section Handling of --debug option below for details.

Config Example

stylus: {
  compile: {
    options: {
      'include css': true,
      'paths': ['path/to/import', 'another/to/import']
    },
    files: {
      'path/to/result.css': 'path/to/source.styl',
      'path/to/another.css': 'path/to/source2.styl'
    }
  }
},

Nib Support

Nib is supported by default. You don’t need to do anything. Just @import 'nib'; anywere you need some nib.

Using Stylus’s url() Function

You can use url() function for embedding images as data:uri. You can define any name for it.

...
options: {
  urlfunc: 'embedurl'
}
...

Now you can write in Stylus files:

E {
  background:embedurl("logo.png");
}

Handling of --debug option

Compression (compress option in Stylus) disables when --debug options for grunt is specified. And enables otherwise.


License

The MIT License, see the included License.md file.

npm loves you