pug-require
v2.0.2
Published
Load Pug templates via require()
Downloads
2
Readme
Pug Require
Allows compiling and loading Pug templates via require('./path/to/template.pug')
.
Installation
$ npm install pug-require
Usage
// Install hooks
const configurePug = require('pug-require');
configurePug({ /* pug options */ });
// Compile template
const pugTemplateFunction = require('./path/to/template.pug');
// Use template
const html = pugTemplateFunction({ /* local variables */ });
API
configurePug(pugOptions)
pugOptions : A Pug options bundle
Regardless of options, attaches the trusted types plugin.
uninstall()
Detaches the Pug hook.
A no-op if not currently installed.
reinstall()
Undoes a call to uninstall
.
A no-op if already installed.