0.0.4 • Published 5 years ago

pug-coffee v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Setup filter

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

Set filename for coffeescript when render

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

Use filter

:coffee
  alert 'hello'

Output:

function () {
  return alert('hello');
}

Pretty render.

:coffee(uglify=false)
  alert 'hello'

Output without uglify.

Render with bare mode.

:coffee(bare=true)
  alert 'hello'

Output:

alert('hello');

Render with script tag.

:coffee(bare=true wrap=true)
  alert 'hello'

Output:

<script>alert('hello');</script>