• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pug HTML loader for webpack

Pug HTML loader for webpack

Installation

npm install pug-html-loader

Usage

In your sources:

var html = require('./file.pug')
// => returns file.pug content as html compiled string

In your webpack.config.js file:

module.exports = {
  // your config settings ...
  rules: [{
    // your modules...
    loaders: [{
      include: /\.pug/,
      loader: ['raw-loader', 'pug-html-loader'],
      options: {
        // options to pass to the compiler same as: https://pugjs.org/api/reference.html
        data: {} // set of data to pass to the pug render.
      }
    }]
  }]
};

Using it with html-loader

pug-html-loader encode to content to a string variable to avoid it and pass the string content to the loader chain please use the following configuration:

module.exports = {
  // your config settings ...
  module: [{
    // your modules...
    rules: [{
      test: /\.pug/,
      loaders: ['html-loader', 'pug-html-loader'],
      options: {
        // options to pass to the compiler same as: https://pugjs.org/api/reference.html
        data: {} // set of data to pass to the pug render.
      }
    }]
  }]
};

Don't forget to polyfill require if you want to use it in node. See webpack documentation.

License

MIT (http://www.opensource.org/licenses/mit-license.php)

More Repositories

1

xatom-debug

A Simple Debugger Provider for Atom
TypeScript
71
star
2

atom-bugs

[MOVED] Atom Bugs has been moved to:
JavaScript
33
star
3

angular-es6-seed

Seed project for angular apps using ES6
JavaScript
8
star
4

progrescii

NodeJS easy graphical progress bars for the terminal.
JavaScript
7
star
5

atom-tab-preview

Code previews for tab items for atom editor
JavaScript
6
star
6

atom-code-ui

A clean and elegant UI Theme for Atom Code.
CSS
5
star
7

jasmine-suite-reporter

Console simple suite reporter for Jasmine 2
JavaScript
2
star
8

atom-wine-syntax

Purple based syntax to those who wants to use the color of creativity! while programming.
CSS
2
star
9

vscode-sundown

TypeScript
2
star
10

angular2-js-seed

Angular2 seed using Javascript ES6
JavaScript
2
star
11

chrome-debugging-protocol

Chrome Debugging Protocol Client for NodeJS
TypeScript
2
star
12

vscode-theme-shark

Shark a VSCode Theme
TypeScript
2
star
13

vscode-outro

The last minimalist theme you'll need
TypeScript
2
star
14

atom-bugs-syntax

CSS
1
star
15

docker-node

NodeJS running on Ubuntu
Shell
1
star
16

shift

1
star
17

codeOS

VSCode Theme
1
star
18

angular-cucumber-seed

JavaScript
1
star
19

xatom-debug-chrome-base

Debugger library to connect with atom-bugs plugin launchers using the Chrome Debugging Protocol.
TypeScript
1
star
20

extension-replace-loader

File extension replace loader for webpack
JavaScript
1
star
21

atom-veggie-syntax

Atom Green Editor Syntax Color
CSS
1
star
22

reactriot2017-sketchyfriends

Draw the secret word / guess what your friend is drawing. (ReactJs Game)
JavaScript
1
star
23

atom-bugs-ui

CSS
1
star
24

atom-code

JavaScript
1
star
25

letsd

Letsd – simple task interface builder
TypeScript
1
star
26

atom-code-syntax

A dark syntax theme to combine with for Atom Code
CSS
1
star