
Simple scaffolding utility, inspired by Sao.js
Installation
$ npm install scaffe
Programmatic Usage
const scaffe = require("scaffe")
async function main(){
...
const s = scaffe.generate(templateDir, outDir, { overwrite: true, variables: { name: "app" } })
s.add("../common/logo.png", "assets/logo.png")
s.add("../common/styles/*.scss", "static/css/")
s.ignore("docs/**/*.scss")
s.ignore("build/**/*")
try {
await s;
} catch(err) {
console.log(err)
}
}
Template directory can have two types of files
starts with _
: this file will be evaluated as an ejs file
doesn't starts with _
: this type of files will be copied as it is to the output directory.
So we can use variables in our template files in ejs format.
A use case,
{
"name": "<%= appName %>"
}
variables
in 3rd argument (i.e. config) will contain all variable values that
need to be passed on to be processed by ejs.
MORE ON USING SCAFFE