metalsmith-simple-includes
v2.1.0
Published
Simple include mechanism for Metalsmith
Downloads
2
Readme
Metalsmith Simple Includes
A very simple Metalsmith plugin that allows content to be included with a directive.
Installation
npm install --save-dev metalsmith-simple-includes
Usage
JavaScript
const includes = require( 'metalsmith-simple-includes' );
Metalsmith( __dirname )
.use( includes( {
directive: '^#include <(.*?)>', // default include directive pattern
directory: '', // default includes directory
pattern: '*.html' // default file pattern to process for include directives
} ) )
.build( error => {
if ( error ) {
console.error( error )
}
} );
#include <path/to/file.ext>
metalsmith.json
{
"plugins": {
"metalsmith-simple-includes": {
"directive": "^#include <(.*?)>",
"directory": "",
"pattern": "*.html"
}
}
}
Options
directive
is the regular expression for the include directivedirectory
is the base directory for your included filespattern
is a glob pattern for filenames to process for include directives
License
The MIT License (MIT)
Thanks
This plugin was developed at Oportun, Inc.