2.0.2 • Published 5 years ago

pug-require v2.0.2

Weekly downloads
4
License
(MIT OR Apache-2....
Repository
github
Last release
5 years ago

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.