Metalsmith plugin to convert pug files.

Usage no npm install needed!

<script type="module">
  import metalsmithPug from '';


Metalsmith Pug version License

Metalsmith plugin to convert pug files.

Build Status Downloads Code Climate Coverage Status Dependencies


npm install --production --save metalsmith-pug


I reccomend using an optimized build matching your Node.js environment version, otherwise, the standard require would work just fine.

 * Node 6
 * Built using `babel-preset-es2015-node6`
const pug = require('metalsmith-pug/lib/node6')

 * Node 5
 * Built using `babel-preset-es2015-node5`
const pug = require('metalsmith-pug/lib/node5')

 * Node 4
 * Built using `babel-preset-es2015-node4`
const pug = require('metalsmith-pug/lib/node4')

 * Node >=0.10 <=0.12
 * Built using `babel-preset-es2015`
var pug = require('metalsmith-pug')


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)


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.


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

Name Type Required Default Details
useMetadata Boolean false Expose Metalsmith's global metadata to the pug template
locals Object {} Pass additional locals to the template
filters Object {} register functions to be used as template filters

:copyright:  ·  License: ISC  ·  Github: @ahmadnassri  ·  Twitter: @ahmadnassri