BREAKING CHANGE(update scope to @pushrocks): update
This commit is contained in:
+18
-11
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './smarthbs.plugins'
|
||||
import * as plugins from './smarthbs.plugins';
|
||||
|
||||
/**
|
||||
* compiles a directory and outputs it
|
||||
@@ -8,15 +8,22 @@ export let compileDirectory = async (
|
||||
destinationDirPathArg: string,
|
||||
dataFileNameArg: string
|
||||
) => {
|
||||
let hbsFilePathArray = plugins.smartfile.fs.listFilesSync(originDirPathArg, /.hbs/)
|
||||
let data = plugins.smartfile.fs.toObjectSync(plugins.path.join(originDirPathArg, dataFileNameArg))
|
||||
let hbsFilePathArray = plugins.smartfile.fs.listFilesSync(originDirPathArg, /.hbs/);
|
||||
let data = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(originDirPathArg, dataFileNameArg)
|
||||
);
|
||||
for (let hbsFilePath of hbsFilePathArray) {
|
||||
let parsedPath = plugins.path.parse(hbsFilePath)
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(originDirPathArg, hbsFilePath))
|
||||
let template = plugins.handlebars.compile(hbsFileString)
|
||||
let output = template(data)
|
||||
console.log('hi ' + output + ' hi')
|
||||
await plugins.smartfile.fs.ensureDir(destinationDirPathArg)
|
||||
plugins.smartfile.memory.toFsSync(output, plugins.path.join(destinationDirPathArg, parsedPath.name + '.html'))
|
||||
let parsedPath = plugins.path.parse(hbsFilePath);
|
||||
let hbsFileString = plugins.smartfile.fs.toStringSync(
|
||||
plugins.path.join(originDirPathArg, hbsFilePath)
|
||||
);
|
||||
let template = plugins.handlebars.compile(hbsFileString);
|
||||
let output = template(data);
|
||||
console.log('hi ' + output + ' hi');
|
||||
await plugins.smartfile.fs.ensureDir(destinationDirPathArg);
|
||||
plugins.smartfile.memory.toFsSync(
|
||||
output,
|
||||
plugins.path.join(destinationDirPathArg, parsedPath.name + '.html')
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user