1.0.5 • Published 2 years ago
tpl-generator v1.0.5
tpl-generator
base on lodash template to generate file
.json as context and .tpl with same name source file
out field as output dir target
useage
npm i -g tpl-generator
tpl-g
example
mkdir .tpldir
touch g.json g.tpl
# g.json
[
{
"path": ["a","b"],
"method": "post",
"params": {"name": "user", "type": "string"},
"out": {"name": "./g/test.java"}
},
]
# g.tpl
<% _.forEach(path, (item, index) => { %>
console.log(<%= item %>, <%= index %>)
<% }) %>
<%= params.name %>
<%= params.type %>