# pug-require

> Load Pug templates via require()

Latest version **2.0.2** (published 2019-05-03) · (MIT OR Apache-2.0) license · 0 weekly downloads

## Install

```sh
npm install pug-require
pnpm add pug-require
yarn add pug-require
bun add pug-require
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2019-05-03 |
| First published | 2018-09-24 |
| Weekly downloads | 0 |
| License | (MIT OR Apache-2.0) |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | @mikesamuel |
| Maintainers | mikesamuel |
| Keywords | pug, template, require |

## Links

- npm: https://www.npmjs.com/package/pug-require
- Repository: https://github.com/mikesamuel/pug-plugin-trusted-types
- Homepage: https://github.com/mikesamuel/pug-plugin-trusted-types/blob/master/packages/require/README.md
- Issues: https://github.com/mikesamuel/pug-plugin-trusted-types/issues
- npm.io page: https://npm.io/package/pug-require

## Dependencies (5)

- [pirates](https://npm.io/package/pirates.md) ^4.0.0
- [module-keys](https://npm.io/package/module-keys.md) ^2.0.2
- [pug-plugin-trusted-types](https://npm.io/package/pug-plugin-trusted-types.md) ^2.0.2
- [pug-runtime-trusted-types](https://npm.io/package/pug-runtime-trusted-types.md) ^2.0.2
- [pug-scrubber-trusted-types](https://npm.io/package/pug-scrubber-trusted-types.md) ^2.0.2

## Recent versions

- 2.0.2 (latest) — 2019-05-03
- 2.0.1 — 2018-12-18
- 2.0.0 — 2018-12-16
- 1.0.15 — 2018-11-29
- 1.0.14-alpha — 2018-11-16
- 1.0.13-alpha — 2018-11-02
- 1.0.12-alpha — 2018-10-25
- 1.0.11-alpha — 2018-10-24
- 1.0.10-alpha — 2018-10-22
- 1.0.9-alpha — 2018-10-16
- 1.0.8-alpha — 2018-10-11
- 1.0.7-alpha — 2018-10-10
- 1.0.6-alpha — 2018-09-27
- 1.0.5-alpha — 2018-09-25
- 1.0.4-alpha — 2018-09-24
- … 1 more at https://npm.io/package/pug-require/versions

## README

# Pug Require

[![npm](https://img.shields.io/npm/v/pug-require.svg)](https://www.npmjs.com/package/pug-require)

Allows compiling and loading [Pug](https://pugjs.org) templates via `require('./path/to/template.pug')`.

<!-- TOC -->
*  [Installation](#hdr-installation)
*  [Usage](#hdr-usage)
*  [API](#hdr-api)
   *  [configurePug(pugOptions)](#hdr-configurepug-pugoptions-)
   *  [uninstall()](#hdr-uninstall-)
   *  [reinstall()](#hdr-reinstall-)

<!-- /TOC -->

## Installation                         <a name="hdr-installation"></a>

```bash
$ npm install pug-require
```

## Usage                                <a name="hdr-usage"></a>

```js
// 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                                  <a name="hdr-api"></a>

### configurePug(pugOptions)            <a name="hdr-configurepug-pugoptions-"></a>

pugOptions : A Pug [options bundle](https://pugjs.org/api/reference.html#options)

Regardless of options, attaches the [trusted types plugin][].

### uninstall()                         <a name="hdr-uninstall-"></a>

Detaches the Pug hook.

A no-op if not currently installed.

### reinstall()                         <a name="hdr-reinstall-"></a>

Undoes a call to `uninstall`.

A no-op if already installed.


[trusted types plugin]: https://npmjs.com/package/pug-plugin-trusted-types

---
_Source: https://npm.io/package/pug-require · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
