now works as intended

This commit is contained in:
2017-05-26 15:32:50 +02:00
parent 8e3633827c
commit 7998c99f27
10 changed files with 47 additions and 9 deletions

View File

@@ -66,6 +66,18 @@ export class ScafTemplate {
}
async writeToDisk (destinationDirArg) {
let smartfileArrayToWrite = plugins.lodash.cloneDeep(this.templateSmartfileArray)
for (let smartfile of smartfileArrayToWrite) {
let template = await plugins.smarthbs.getTemplateForString(
smartfile.contents.toString()
)
let renderedTemplateString = template(this.suppliedVariables)
smartfile.contents = Buffer.from(renderedTemplateString)
}
await plugins.smartfile.memory.smartfileArrayToFs(smartfileArrayToWrite, destinationDirArg)
}
/**
* finds all variables in a Template in as string
* e.g. myobject.someKey and myobject.someOtherKey