Skip to content

A Metalsmith plugin for importing template data from javascript files

License

Notifications You must be signed in to change notification settings

shebson/metalsmith-template-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Metalsmith plugin for importing template data from javascript files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published