Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including metalsmith-templates with all npm packages installed. Try it out:

var metalsmithTemplates = require("metalsmith-templates")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-templates v0.7.0

A metalsmith plugin to render files with templates.

metalsmith-templates

A metalsmith plugin to render files with templates.

You can use any templating engine supported by consolidate.js.

Installation

$ npm install metalsmith-templates

CLI Usage

Install the node modules and then add the metalsmith-templates key to your metalsmith.json plugins. The simplest use case just requires the template engine you want to use:

{
  "plugins": {
    "metalsmith-templates": "handlebars"
  }
}

If you want to specify additional options, pass an object:

{
  "plugins": {
    "metalsmith-templates": {
      "engine": "handlebars",
      "directory": "templates"
    }
  }
}

Javascript Usage

For the simplest use case, just pass your templating engine:

var templates = require('metalsmith-templates');

metalsmith.use(templates('swig'));

To specify additional options:

metalsmith.use(templates({
  engine: 'swig',
  directory: 'templates'
}));

License

MIT

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free