1.1.7 • Published 11 months ago
pug-html-loader v1.1.7
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 stringIn 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
1.1.7
11 months ago
1.1.6
12 months ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.10
9 years ago
1.0.9
9 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago