Skip to content

Latest commit

 

History

History
79 lines (55 loc) · 2.15 KB

README.md

File metadata and controls

79 lines (55 loc) · 2.15 KB

@metalsmith/remove

A Metalsmith plugin to remove files from the build

metalsmith: core plugin npm: version ci: build code coverage license: MIT

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/*"] }]
}

License

MIT