This library is inspired by yenv composition, the yaml environment manage stuff library.
npm install --save symbolic-json
Requires node v4.x or above.
Declaring a 'symbolic link' in a file (eg. pages.json
):
{
"header": __header.html,
"body": __content/body.html
}
Reading the file:
const symbolicJSON = require('symbolic-json');
// Reference the json file
const jsonContent = symbolicJSON('pages.json');
// File will now have hydrated content from the symbolic links
console.log(jsonContent);
You can link to text, json, or html files recursively with the __
operator.
{
"body": __content/body.html,
"tags": __content/tags.json,
"description": __content/description.txt
}
Links are relative to the file being parsed.
+---content.json
+---content
| +---body.html
| +---tags.json
| +---tags.description.txt
Please see CHANGELOG.md
Jon West - @ddproxy