Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metalsmith/remove

A Metalsmith plugin to remove files from the build
https://github.com/metalsmith/remove

metalsmith metalsmith-plugin remove

Last synced: 2 days ago
JSON representation

A Metalsmith plugin to remove files from the build

Awesome Lists containing this project

README

        

# @metalsmith/remove

A Metalsmith plugin to remove files from the build

[![metalsmith: core plugin][metalsmith-badge]][metalsmith-url]
[![npm: version][npm-badge]][npm-url]
[![ci: build][ci-badge]][ci-url]
[![code coverage][codecov-badge]][codecov-url]
[![license: MIT][license-badge]][license-url]

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:

```bash
npm install @metalsmith/remove
```

Yarn:

```bash
yarn add @metalsmith/remove
```

## Usage

Pass the plugin with options to `Metalsmith#use`:

```js
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*`:

```js
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:

```json
{
"plugins": [{ "@metalsmith/remove": "drafts/*" }]
}
```

But you can also pass an array of patterns to ignore:

```json
{
"plugins": [{ "@metalsmith/remove": ["drafts/*", "unfinished/*"] }]
}
```

## License

[MIT](LICENSE)

[npm-badge]: https://img.shields.io/npm/v/@metalsmith/remove.svg
[npm-url]: https://www.npmjs.com/package/@metalsmith/remove
[ci-badge]: https://github.com/metalsmith/remove/actions/workflows/test.yml/badge.svg
[ci-url]: https://github.com/metalsmith/remove/actions/workflows/test.yml
[metalsmith-badge]: https://img.shields.io/badge/metalsmith-plugin-green.svg?longCache=true
[metalsmith-url]: https://metalsmith.io
[codecov-badge]: https://img.shields.io/coveralls/github/metalsmith/remove
[codecov-url]: https://coveralls.io/github/metalsmith/remove
[license-badge]: https://img.shields.io/github/license/metalsmith/remove
[license-url]: LICENSE