symbolic-json

0.1.0 • Public • Published

symbolic-json

npm version Dependency Status Build Status Coverage Status

Credits

This library is inspired by yenv composition, the yaml environment manage stuff library.

Installation

npm install --save symbolic-json

Requires node v4.x or above.

Usage

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);

Symbolic Links

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

Changelog

Please see CHANGELOG.md

Author

Jon West - @ddproxy

Package Sidebar

Install

npm i symbolic-json

Weekly Downloads

9

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ddproxy