jr-stylus

0.2.6 • Public • Published

JR-STYLUS

A jr job for stylus.

Example

var jrStylus = require('jr-stylus');

jrStylus({
  inDir: 'styl',
  outFile: 'styles.css',
  settings: {
    paths: [ 'mixins' ]
  },
  defines: {
    borderRadius: 5
  }
}, function (err) {
  if (err) {
    console.log(err);
  }
});

Given styl/button.styl:

@import 'border-radius'

.button
  border-radius(unit(borderRadius,'px'))

and mixins/border-radius.styl:

border-radius(n)
  -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;
}

Details

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.

Dependencies (4)

Dev Dependencies (1)

Package Sidebar

Install

npm i jr-stylus

Weekly Downloads

8

Version

0.2.6

License

none

Last publish

Collaborators

  • jraymakers