pug-frontmatter-html-loader
Webpack loader for rendering pug to html with frontmatter support.
About
pug-frontmatter-html-loader
is a webpack loader.
It renders pug templates to HTML using template data from
optional yaml frontmatter parsed with
gray-matter.
Simple example pug template with frontmatter:
---content: "Hello World"---p= content
This gives you a convenient way to define more complex template data directly in your template file. As frontmatter usage is optional, this can also be used as a plain pug to html loader.
Installation
pug-frontmatter-html-loader
is a public npm package. You can install it using
npm:
npm i -D pug-frontmatter-html-loader
Usage
Simply add it as a loader in your webpack config's module rules:
module:rules:test: /\.pug$/use: 'pug-frontmatter-html-loader'
This loader outputs strings. If you want to use them in javascript context, prepend the raw-loader to your loader chain.
Options
See pug compiler options.