Skip to content

A metalsmith plugin for in-place templating

Notifications You must be signed in to change notification settings

nategreen/metalsmith-in-place

 
 

Repository files navigation

metalsmith-in-place

npm version build status downloads slack chat

A metalsmith plugin for in-place templating

This plugin allows you to render templates. For support questions please use stack overflow or our slack channel.

Installation

$ npm install metalsmith-in-place

Options

You can pass options to metalsmith-in-place with the Javascript API or CLI. The options are:

  • engine: the engine that will be used for processing files (optional, default: jstransformer)
  • engineOptions: an object with options that will be passed to the engine (optional, default: {})
  • pattern: only files that match this pattern will be processed (optional, default: **)

engine

The engine that will be used to process files. The default engine is jstransformer, but any compatible engine can be used. To select a different engine you must use metalsmith's Javascript API like so:

var metalsmith = require('metalsmith')
var inPlace = require('metalsmith-in-place')
var Consolidate = require('metalsmith-engine-consolidate')

metalsmith(__dirname)
  .use(inPlace({
    engine: Consolidate
  }))
  .build(function(err){
    if (err) throw err;
  });

This would use consolidate to process files. See each engine's documentation for options and implementation details.

engineOptions

These options will be passed on to the selected engine. So this configuration:

var metalsmith = require('metalsmith')
var inPlace = require('metalsmith-in-place')

metalsmith(__dirname)
  .use(inPlace({
    engineOptions: {
      "cache": false
    }
  }))
  .build(function(err){
    if (err) throw err;
  });

Would pass { "cache": false } to the selected engine.

pattern

Only files that match this pattern will be processed. So this configuration:

var metalsmith = require('metalsmith')
var inPlace = require('metalsmith-in-place')

metalsmith(__dirname)
  .use(inPlace({
    pattern: "**/*.hbs"
  }))
  .build(function(err){
    if (err) throw err;
  });

Would only process files that have the .hbs extension.

Credits

License

MIT

About

A metalsmith plugin for in-place templating

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%