Create tasteful scripted templates for your repetiteve work. After that just do ./gourmet tasteful-script.js and enjoy! Use it to generate entities, rest routes, sql files, and anything else where a kickstart will be welcome.
Use js to explain what you want to do with a template. First example:
var tmpl = 'Hello {{name}}';
var value = { name: 'Daniel' };
var txt = tt.mustache(tmpl, value)
tt.save('file-name.txt', txt)
-
Install gourmet-generator globally
npm install -g gourmet-generator
-
Create a gourmet template script (like the one above) and save somewhere like
/folder/templates/ex.js
-
Inside a cmd use:
gourmet /folder/templates/ex.js param1 param2 param3
The tt is a global variable to execute frequently required stuff like:
-
Save a file:
tt.save(file, text);
where file is a path related to the folder where you currently are and text is the text that you want to save in utf8 -
Read: Sometimes its better to write the mustache files on its own file.
tt.read(file)
where file is a path related to the folder where you currently are -
Render mustache: Will transform a mustache template and an object with values into a string
tt.mustache(template, values)