1.2.0 • Published 6 years ago
pug-generate v1.2.0
pug-generate
Compile Pug to xml, or html etc.
Releases
1.1.0
- Adding hooks;
beforeCompile
,AfterCompile
1.2.0
- Adding hooks parameters;
path
,stat
Installation
npm install --save-dev pug-generate
Usage
const pugGenerate = require('pug-generate');
const path = require('path');
pugGenerate({
output: path.join(__dirname, 'dist'),
path: path.join(__dirname, 'resources/views'),
globalVariable: {
message: 'HelloWorld !',
users: [
{ name: 'Bill Gates' },
{ name: 'Steve Jobs '},
{ name: 'Stephen William Hawking'}
]
},
pugOptions: {
pretty: true
},
afterCompile: function($) {
console.log($.html());
}
})
Options
Name | Default | Description |
---|---|---|
output | dist | Output path for compiled pug |
outputExtension | .html | Output files extension |
path | . | The directory which include pug |
globalVariable | {} | Global Variables which used in pug |
pugOptions | {} | https://pugjs.org/api/reference.html |
xmlMode | false | Using xmlMode |
Hooks
These hooks are not Event
Name | Parameter | Description |
---|---|---|
beforeCompile | path: string, stat: object | Called before compiling Pug |
afterCompile | $: Cheerio, path: string, stat: object | Called after compiling Pug |
License
MIT
Copyright (c) Mansu Jeong. All rights reserved.