Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KiaraGrouwstra/rollup-plugin-pug-html
Rollup plugin that allows importing Pug templates as HTML strings
https://github.com/KiaraGrouwstra/rollup-plugin-pug-html
Last synced: 25 days ago
JSON representation
Rollup plugin that allows importing Pug templates as HTML strings
- Host: GitHub
- URL: https://github.com/KiaraGrouwstra/rollup-plugin-pug-html
- Owner: KiaraGrouwstra
- License: mit
- Fork: true (aMarCruz/rollup-plugin-pug)
- Created: 2016-10-04T11:16:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-12T01:56:04.000Z (about 8 years ago)
- Last Synced: 2024-10-29T18:05:53.290Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - pug-html - Import Pug Templates as HTML strings during a build. (Plugins / Templating)
README
[![Build Status][build-image]][build-url]
[![npm Version][npm-image]][npm-url]
[![License][license-image]][license-url]# rollup-plugin-pug-html
[Rollup](https://github.com/rollup/rollup) plugin that allows importing [pug](https://pugjs.org/) templates as HTML strings.
## Installation
```bash
npm install --save-dev rollup-plugin-pug-html
```## Usage
Create the template:
```jade
//- template.pug
p Hello #{ name }
```Import the template:
```js
// main.js
import html from './template.pug';
console.log(html); //Hello World
```And build with something like...
```js
import { rollup } from 'rollup';
import pug from 'rollup-plugin-pug-html';rollup({
entry: 'src/main.js',
plugins: [
pug({
// By default, all .jade and .pug files are compiled
// extensions: [ '.jade', '.pug' ],
// You can restrict which files are compiled
// using `include` and `exclude`
include: 'src/components/**.pug',
// You can use native pug options as well.
pretty: true,
// You can also pass context for the Pug variables:
context: { name: 'World' },
})
]
}).then(...)
```That's it.
## Options
This plugin is using the following pug options as defaults:
```js
{
doctype: 'html',
name: 'template',
compileDebug: false,
inlineRuntimeFunctions: false,
context: {},
}
```See the full list and explanation in the [API Documentation](https://pugjs.org/) of the Pug site.
## Licence
MIT
[build-image]: https://img.shields.io/travis/tycho01/rollup-plugin-pug-html.svg
[build-url]: https://travis-ci.org/tycho01/rollup-plugin-pug-html
[npm-image]: https://img.shields.io/npm/v/rollup-plugin-pug-html.svg
[npm-url]: https://www.npmjs.com/package/rollup-plugin-pug-html
[license-image]: https://img.shields.io/npm/l/express.svg
[license-url]: https://github.com/tycho01/rollup-plugin-pug-html/blob/master/LICENSE