A JR job for stylus.


A jr job for stylus.

var jrStylus = require('jr-stylus');
  inDir: 'styl',
  outFile: 'styles.css',
  settings: {
    paths: [ 'mixins' ]
  defines: {
    borderRadius: 5
}, function (err) {
  if (err) {

Given styl/button.styl:

@import 'border-radius'

and mixins/border-radius.styl:

  -webkit-border-radius n
  -moz-border-radius n
  border-radius n

this writes styles.css:

.button {
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;

Jr-stylus is a function that compiles a set of stylus files into a single css file. Although designed to be used with jr, it does not depend on jr and can be used by itself.

All *.styl files in 'inDir' (non-recursive) will be compiled into a single css file, 'outFile'. Because 'inDir' is not traversed recursively, stylus partials and mixins can be stored in subdirectories without being included in the output file directly.

See the stylus JavaScript API for details on 'settings' and 'defines'.

Jr-stylus is a thin wrapper around the stylus JavaScript API. Stylus provides an API to compile stylus strings, and a command-line tool to compile stylus files, but no API to compile files. Jr-stylus fills this gap.