metalsmith-pathnames

1.1.0 • Public • Published

Metalsmith Pathnames

A very simple Metalsmith plugin that adds path and filename to a file's metadata.

Installation

npm install --save-dev metalsmith-pathnames

Usage

JavaScript

const pathnames = require( 'metalsmith-pathnames' );

Metalsmith( __dirname )
    .use( pathnames( {
        pattern: '**/*.html', // default file pattern to add path/filename to
        index: '**/index.html', // default index name to strip,
        base: '' // default base directory,
        replacements: [] // default replacements to perform on path
    } ) )
    .build( error => {
        if ( error ) {
            console.error( error )
        }
    } );

metalsmith.json

{
  "plugins": {
    "metalsmith-pathnames": {
        "pattern": "**/*.html",
        "index": "**/index.html",
        "base": "",
        "replacements": []
    }
  }
}

Options

  • pattern is the file glob to match for files to add path/filename
  • index is the file glob mathing your index to be stripped from the path
  • base is an optional base directory to add
  • replacements is an optional array of RegExp/replacement pairs

License

The MIT License (MIT)

Thanks

This plugin was developed at Oportun, Inc.

Readme

Keywords

none

Package Sidebar

Install

npm i metalsmith-pathnames

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • andyburke