metalsmith-simple-includes

2.1.0 • Public • Published

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 directive
  • directory is the base directory for your included files
  • pattern is a glob pattern for filenames to process for include directives

License

The MIT License (MIT)

Thanks

This plugin was developed at Oportun, Inc.

Readme

Keywords

none

Package Sidebar

Install

npm i metalsmith-simple-includes

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

3.33 kB

Total Files

3

Last publish

Collaborators

  • andyburke