1.0.0 • Published 4 years ago

metalsmith-mogrify v1.0.0

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

metalsmith-mogrify

A metalsmith plugin for removing metadata from files using ImageMagick's Mogrify program.

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

Installation

npm install metalsmith-mogrify

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 mogrify = require('metalsmith-mogrify');

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

JSON

{
  "plugins": {
    "metalsmith-mogrify": {}
  }
}

Options

You can pass options to metalsmith-mogrify 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 Mogrify.

pattern

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

JavaScript

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

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

JSON

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

Would only remove metadata from PNG 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