@metalsmith/remove
v1.4.0
Published
A Metalsmith plugin to remove files from the build
Downloads
759
Readme
@metalsmith/remove
A Metalsmith plugin to remove files from the build
Use @metalsmith/remove
to discard files from the build output after their metadata and contents have been read and used by plugins. While Metalsmith#ignore
ignores the matched files completely, @metalsmith/remove
only removes them at the point the plugin is use
'd.
Installation
NPM:
npm install @metalsmith/remove
Yarn:
yarn add @metalsmith/remove
Usage
Pass the plugin with options to Metalsmith#use
:
import remove from '@metalsmith/remove'
metalsmith.use(remove('drafts/*')) // single pattern
metalsmith.use(remove(['drafts/*', 'unfinished/*'])) // multiple patterns
Debug
To enable debug logs, set the DEBUG
environment variable to @metalsmith/remove*
:
metalsmith.env('DEBUG', '@metalsmith/remove*')
Alternatively you can set DEBUG
to @metalsmith/*
to debug all Metalsmith core plugins.
CLI Usage
To use this plugin with the Metalsmith CLI, add @metalsmith/remove
to the plugins
key in your metalsmith.json
file:
{
"plugins": [{ "@metalsmith/remove": "drafts/*" }]
}
But you can also pass an array of patterns to ignore:
{
"plugins": [{ "@metalsmith/remove": ["drafts/*", "unfinished/*"] }]
}