pug-frontmatter-html-loader

0.1.2 • Public • Published

pug-frontmatter-html-loader

Webpack loader for rendering pug to html with frontmatter support.


npm package version Travis CI build status Coverage Status

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.

License

MIT @ 2018 Simon Lepel

/pug-frontmatter-html-loader/

    Package Sidebar

    Install

    npm i pug-frontmatter-html-loader

    Weekly Downloads

    11

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    6.19 kB

    Total Files

    4

    Last publish

    Collaborators

    • simbo