0.0.1 • Published 9 years ago

metalsmith-template-data v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

metalsmith-template-data

Build Status Coverage Status Dependency Status devDependency Status

A Metalsmith plugin to import template data from CommonJS modules. This plugin extends Metalsmith file objects with the contents of any CommonJS modules specified by the dataFile property of the file.

Installation

$ npm install metalsmith-template-data

YAML front matter

To import a CommonJS module as template data, add the dataFile property to your file's YAML front matter:

---
template: base.html
dataFile: data/index.js
---

You data file should export an object.

If any properties of the imported data object conflict with properties you define in your YAML front matter, the values specified in the data file will override those specified in front matter.

JavaScript usage

var templateData = require('metalsmith-template-data');
metalsmith.use(templateData());

CLI usage

{
  "plugins": {
    "metalsmith-template-data": {}
  }
}

License

MIT