metalsmith-json-api
v0.5.1
Published
## Usage Use this plugin like any other Metalsmith plugin: ```js var Metalsmith = require('metalsmith'), api = require('metalsmith-json-api'), ...;
Downloads
2
Readme
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 toapi/
)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.