barnes-consolidate
v0.1.0-alpha.b035843b
Published
Make HTML files with just about any templating language!
Downloads
1
Readme
Barnes-Consolidate
Make HTML files with just about any templating language!
Prerequisites
You'll need to install the appropriate template language package, write
your templates in that format, and specify a layout
field on records you'd
like to render.
Installation
yarn add barnes-consolidate
Usage
import Barnes from 'barnes';
import consolidate from 'barnes-consolidate';
import * as nunjucks from 'nunjucks';
(async () => {
await new Barnes('/Users/Dev/Documents')
.read('**/*.md')
// assign layout property to each file
.map(file => Object.assign(file, { layout: 'file.njk' }))
// convert layout'd files to HTML
.map(consolidate('nunjucks'))
// all layout'd files are now HTML!
.write('public');
}());