Code Monkey home page Code Monkey logo

metalsmith-pug's Introduction

Metalsmith Pug version License

Metalsmith plugin to convert pug files.

Build Status Downloads Code Climate Coverage Status Dependency Status Dependencies

Install

npm install --only=production --save 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:

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

©️ ahmadnassri.com  ·  License: ISC  ·  Github: @ahmadnassri  ·  Twitter: @ahmadnassri

metalsmith-pug's People

Contributors

greenkeeperio-bot avatar ianstormtaylor avatar kmiyashiro avatar kylepaulsen avatar maxbareiss avatar shimbaco avatar surgo avatar sventschui avatar wspringer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.