1.2.0 • Published 6 years ago

pug-generate v1.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

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

NameDefaultDescription
outputdistOutput path for compiled pug
outputExtension.htmlOutput files extension
path.The directory which include pug
globalVariable{}Global Variables which used in pug
pugOptions{}https://pugjs.org/api/reference.html
xmlModefalseUsing xmlMode

Hooks

These hooks are not Event

NameParameterDescription
beforeCompilepath: string, stat: objectCalled before compiling Pug
afterCompile$: Cheerio, path: string, stat: objectCalled after compiling Pug

License

MIT

Copyright (c) Mansu Jeong. All rights reserved.