metalsmith-include
Make the contents of other source files as properties on a metalsmith file object. Can be used as a rudimentary partial system for metalsmith-templates
.
Example
index.md:
Note the lack of extension on thanks
- this provides maximum flexibility, since you may have a markdown parser that converts thanks.md
to thanks.html
, and this plugin will search for any extension if none is provided
---template: home.jadeinclude: thanks: thanks--- ### Welcome to my website!
home.jade:
.main !=contents !=thanks
thanks.md:
---template: thanks.jadepartial: true--- #### Thanks for visiting!
thanks.jade:
.thanks !=contents
Output:
Welcome to my website! Thanks for visiting!
Installation
$ npm install metalsmith-include
Options
The only option is deletePartials
, which tells metalsmith-include
whether or not to remove files that are included in other files, and have a partial
indicator in their front-matter. Defaults to true.
CLI Usage
Install via npm and then add the metalsmith-include
key to your metalsmith.json
plugins with your options passed as an object:
Javascript Usage
Pass options
to the include plugin and pass it to Metalsmith with the use
method:
var include = ; metalsmith;
License
MIT