pug-coffee

0.0.4 • Public • Published

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>

Readme

Keywords

none

Package Sidebar

Install

npm i pug-coffee

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

2.92 kB

Total Files

5

Last publish

Collaborators

  • billypon