1.0.0 • Published 4 years ago

metalsmith-mat2 v1.0.0

Weekly downloads
-
License
AGPLv3
Repository
github
Last release
4 years ago

metalsmith-mat2

A metalsmith plugin for removing metadata from files using MAT2.

This plugin removes metadata from files using the MAT2 program. If MAT2 is not installed and available on the $PATH, no metadata will be removed using this plugin.

Installation

npm install metalsmith-mat2

Usage

To use this plugin, simply add it to the existing plugins in your Metalsmith source file or include it in the Metalsmith JSON file:

JavaScript

const Metalsmith = require('metalsmith');
const mat2 = require('metalsmith-mat2');

Metalsmith(__dirname)
  .use(mat2())
  .build((err, files) => {
    if (err) { throw err; }
  });

JSON

{
  "plugins": {
    "mat2": {}
  }
}

Options

You can pass options to metalsmith-mat2 with the Javascript API or CLI. The options are:

  • pattern: optional. Only files that match this pattern will be processed. Accepts a string or an array of strings. The default is all of the files types that are supported by MAT2.

pattern

Only files that match this pattern will be processed. So this Metalsmith JavaScript configuration or metalsmith.json:

JavaScript

const Metalsmith = require('metalsmith');
const mat2 = require('metalsmith-mat2');

Metalsmith(__dirname)
  .use(mat2({
    pattern: 'blog/**/*.html',
  }))
  .build((err, files) => {
    if (err) { throw err; }
  });

JSON

{
  "source": "src",
  "destination": "build",
  "plugins": {
    "metalsmith-mat2": {
      "pattern": "blog/**/*.html"
    }
  }
}

Would only remove metadata from HTML files within the ./src/blog folder, because the pattern is relative to your source folder. See multimatch for further details.

License

AGPLv3

1.0.0

4 years ago