2.1.0 • Published 6 years ago

metalsmith-simple-includes v2.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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.

2.1.0

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago