static-engine-render
v5.12.2
Published
Plugin for static-engine. It renders and saves a file using a provided render function for each object in the collection.
Downloads
4
Readme
static-engine-render
This is a plugin for static-engine. It renders and saves a file using a provided render function for each object in the collection. Pass it first a route, the file to save. It will interpolate properties from each object into the string provided. Second pass it a function to use for rendering. For each object in the collection it is passed first the object and then a callback function. The renderer may use the callback or optionally return a promise.
var engine = require('static-engine')
var render = require('static-engine-render')
var pluginA = require('plugin-a')
var renderer = function (page, done) {
// some templating
done(err, result)
}
engine([
pluginA,
render('./your-route/:var/index.html', renderer)
])