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;
});
: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>