Mustgen is a very simple file generator based on handlebars. It takes {{mustached}} template and javascript object as a map with values and file definitions, then generates string using handlebars, and writes it to a file.
It was created as an alternative code generator for Entitas.
If you don't have node.js installed on your machine, install from Node.js website.
$ cd pathToYourProject
$ npm install mustgen --save
var helloFile = {
template: 'hello.hbs',
output: 'hello.txt',
data: {
name: "totally useful tool",
words: ["Lonely", "Sad", "Depressed"],
person: {
name: "Stephen",
lastname: "King"
}
}
}
module.exports = {
files: [helloFile],
helpers: {},
partials: {},
// For safety reasons, output folder name
// should contain '_generated'.
// This folder will be constantly cleaned.
output: '_generated'
};
require('mustgen')('./', './map');
$ node server
Hello totally useful tool.
Random words: Lonely Sad Depressed
And this is block of Stephen King.
Check out EntitasMustgen, it's a boilerplate for Entitas API generation.