metalsmith-pathnames
v1.1.0
Published
Adds path and filename to metadata
Downloads
4
Readme
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/filenameindex
is the file glob mathing your index to be stripped from the pathbase
is an optional base directory to addreplacements
is an optional array of RegExp/replacement pairs
License
The MIT License (MIT)
Thanks
This plugin was developed at Oportun, Inc.