DISP2 is a self-generated templating engine for any language.
It is essentially a JSON converter, which convert a legal JSON format file to a series of text files. You can define the generation criteria by you own.
For complex criterias, you can event write Javascript in the template file.
Its core function works like advanced m4 language, but based on javascript.
Features:
- Pure nodejs (without any dependencies)
- Run on all mainstream OS (like Linux, Windows and Mac)
- Easy to learn (only two grammars)
- Compatible to almost all frameworks (yes, it is)
- Easily extendable (you can write your own modules)
npm install --global disp2
git clone https://github.com/doitsimple/disp2
Once installed with npm, you can create a project.json
{
"env":{
"name": "Yu",
"hobby": "cooking"
}
}
Then you can create any file begin with 'disp', like disp2.doc.txt
^^=name$$ likes ^^=hobby$$
if installed with npm -g
disp2
if cloned with git
{path to repo}/bin/disp2
Then you will see a doc.txt
Yu likes cooking
See example/1-simple
for the code.