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.
$ npm install metalsmith-in-place
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:**
)
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.
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.
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.
- Ian Storm Taylor for creating metalsmith-templates, on which this plugin was based
- Rob Loach for creating metalsmith-jstransformer, which inspired our switch to jstransformers
MIT