/pug-stylus

Primary LanguageJavaScript

Setup filter

Install dependencies

npm install stylus

Set as pug filter

const pug = require('pug');
pug.filters.stylus = require('pug-stylus')();

Set filename for stylus when render

pug.filters.stylus = require('pug-stylus')(function (options, args) {
  options.filename = args.filename;
});

Use filter

:stylus
  body
    color red

Output:

body{color:red}

Pretty render.

:stylus(compress=false)
  body
    color red

Output:

body {
  color: red;
}

Render with style tag.

:stylus(wrap=true)
  body
    color red

Output:

<style>body{color:red}</style>