💬 Metalsmith plugin to define values in the metadata
JavaScript HTML
Permalink
Failed to load latest commit information.
example chore: spring cleaning Mar 30, 2016
lib docs: update jsdoc Apr 1, 2016
test
.appveyor.yml chore: add Node.js 6 to Travis/AppVeyor Jun 10, 2016
.codeclimate.yml
.editorconfig
.gitignore
.travis.yml
npm-shrinkwrap.json
package.json
readme.md

readme.md

NPM version Linux build status Windows build status Code coverage GPA Dependencies status

metalsmith-define

A Metalsmith plugin to define values in the metadata.

Installation

$ npm install metalsmith-define

Usage

Why you would use it is up to you, but here some ideas:

  • expose a node module (e.g.: Underscore.js) in the metadata to use it in a template
  • set variable related to the build script (e.g.: development/production environment)
  • expose JSON files (e.g.: expose the package.json file similarly to how it's done in a classic Gruntfile)
  • expose your own JavaScript modules (e.g.: define custom helper functions)

CLI

{
  "plugins": {
    "metalsmith-define": {
      "production": true
    }
  }
}

JavaScript

var MetalSmith = require('metalsmith');
var define = require('metalsmith-define');

Metalsmith(__dirname)
  .use(define({
    '_': require('underscore'),
    development: true,
    pkg: require('./package.json'),
    helpers: require('./helpers.js')
  }))

The option object passed to metalsmith-define contains couples of key/value. Each value will be exposed in the metadata at the corresponding key.

Changelog

  • 2.0.1

    • Switch test suite to nyc + ava
  • 2.0.0

    • Add AppVeyor
    • Add EditorConfig
    • Change license
    • Switch to standard coding style
    • 100% code coverage
    • Fix dependencies with shrinkwrap
    • Bump dependencies
    • Switch test engine to tape
  • 1.0.0

    • Bump stable
  • 0.0.2

    • Switch to Mocha/Chai to test
  • 0.0.1

    • Define key/values in the metadata

License

CC0

To the extent possible under law, Aymeric Beaumet has waived all copyright and related or neighboring rights to this work.