metalsmith-json-api

0.5.1 • Public • Published

Metalsmith JSON API

Usage

Use this plugin like any other Metalsmith plugin:

var Metalsmith = require('metalsmith'),
    api        = require('metalsmith-json-api'),
    ...;

Metalsmith(__dirname)
    .use(...)
    ...
    .use(api())
    .build();

This will create unique ids based on the files content and create a JSON file with the name of the unique id. The unique ids are saved in _uid and a link to the api file is saved at _apiURL on every file (so they can be accessed in templates).

Options

  • path: The path where the json files will be saved (default to api/)
  • pattern: glob pattern (array) to specify the files that should be handled by this plugin (defaults to all)
  • ignoreKeys: An array of keys that should be ignored from the metalsmith file object (i. e. if you are using a plugin that creates circular references)

Tests

Run npm test or mocha -u tdd to run the test suite.

Readme

Keywords

none

Package Sidebar

Install

npm i metalsmith-json-api

Weekly Downloads

0

Version

0.5.1

License

MIT

Last publish

Collaborators

  • robinthrift