3.0.1 • Published 1 year ago

metalsmith-pug v3.0.1

Weekly downloads
33
License
MIT
Repository
github
Last release
1 year ago

Metalsmith Pug

Metalsmith plugin to convert pug files

license release semantic

Install

npm install metalsmith-pug

Usage

I recommend using an optimized build matching your Node.js environment version, otherwise, the standard require would work just fine with any version of Node >= v4.0 .

/*
 * Node 7
 */
const metalsmith-jade = require('metalsmith-jade/lib/node7')

/*
 * Node 6
 */
const metalsmith-jade = require('metalsmith-jade/lib/node6')

/*
 * Node 4 (Default)
 * Note: additional ES2015 polyfills may be required
 */
var metalsmith-jade = require('metalsmith-jade')

API

Pass options to the pug plugin and pass it to Metalsmith with the use method:

import Metalsmith from 'metalsmith'
import pug from 'metalsmith-pug'

const options = {
  pretty: false,

  locals: {
    postName: 'good post name'
  },

  filters: {
    foo: block => block.replace('foo', 'bar')
  }
}

new Metalsmith(__dirname)
  .use(pug(options))

CLI

You can also use the plugin with the Metalsmith CLI by adding a key to your metalsmith.json file:

{
  "plugins": {
    "metalsmith-pug": {
      "pretty": false
    }
  }
}

All options are passed directly to pug. If options has a locals key, that will be passed along to pug.

Options

any of the options parameters for pug with the additional plugin specific properties below:

NameTypeRequiredDefaultDetails
useMetadataBooleanfalseExpose Metalsmith's global metadata to the pug template
localsObject{}Pass additional locals to the template
filtersObject{}register functions to be used as template filters

Author: Ahmad Nassri  Twitter: @AhmadNassri

3.0.1

1 year ago

3.0.0

1 year ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago