jsn
jsn is an open-source Node to JavaScript variable parser.
What does JSN do?
jsn will take variables you pass as a context, and parse the source code to produce valid JavaScript.
Sample .jsn file:
var thatMuch = '@how.awesome';;
You will need to install jsn, you can do that directly from npm
npm install jsn
In your Node.JS code, you can parse these variables by accessing the jsn compiler.
var jsn = ; jsn;
You can alternatively use jsn.parseFile(path, model, callback)
to use a template file directly, instead.
This is particularly useful when you have small pieces of data you want to pass to your JavaScript files. It's often most useful when paired with node-assetify, which supports jsn out the box.
To keep things simple, JSN supports only context variable names with [A-z], [0-9], -, or _ characters. @
characters can be escaped using @@
.