npm.io
2.0.2 • Published 7 years ago

pug-require

Licence
(MIT OR Apache-2.0)
Version
2.0.2
Deps
5
Size
5 kB
Vulns
0
Weekly
0
Stars
5

Pug Require

npm

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.

Keywords