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.
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.
Controls how this task (and its helpers) operate and should contain key:value pairs, see Options section below.
Specifies directories to scan for @import directives when parsing.
-
You can specify all other Stylus options you need: eg.
include css. -
Options
compressis enabled by default. See section Handling of--debugoption below for details.
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 is supported by default. You don’t need to do anything. Just @import 'nib'; anywere you need some nib.
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");
}Compression (compress option in Stylus) disables when --debug options for grunt is specified. And enables otherwise.
The MIT License, see the included License.md file.
