rename templates in .hbs
This commit is contained in:
parent
c2eaa80923
commit
529edaa058
|
@ -89,13 +89,13 @@ class ScaffoldingReact {
|
|||
try {
|
||||
const filename = contract.className.toLowerCase();
|
||||
|
||||
this._generateFile(contract, 'index.html.tpl', 'html',
|
||||
this._generateFile(contract, 'index.html.hbs', 'html',
|
||||
{
|
||||
'title': contract.className,
|
||||
filename
|
||||
}, overwrite);
|
||||
|
||||
const filePath = this._generateFile(contract, 'dapp.js.tpl', 'js',
|
||||
const filePath = this._generateFile(contract, 'dapp.js.hbs', 'js',
|
||||
{
|
||||
'title': contract.className,
|
||||
'contractName': contract.className,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
const Handlebars = require('handlebars');
|
||||
const fs = require('../../core/fs');
|
||||
const utils = require('../../utils/utils');
|
||||
|
||||
const capitalize = string => string.charAt(0).toUpperCase() + string.slice(1);
|
||||
|
||||
|
@ -20,11 +21,12 @@ class ScaffoldingSolidity {
|
|||
throw new Error("file '" + filePath + "' already exists");
|
||||
}
|
||||
|
||||
const templatePath = fs.embarkPath('lib/modules/scaffolding-solidity/templates/' + templateFilename);
|
||||
const templatePath = utils.joinPath(__dirname, 'templates/' + templateFilename);
|
||||
const source = fs.readFileSync(templatePath).toString();
|
||||
const template = Handlebars.compile(source);
|
||||
|
||||
// Write template
|
||||
console.dir(data);
|
||||
const result = template(data);
|
||||
fs.writeFileSync(filePath, result);
|
||||
return filePath;
|
||||
|
@ -36,7 +38,7 @@ class ScaffoldingSolidity {
|
|||
|
||||
const filename = contract.className;
|
||||
|
||||
const filePath = this._generateFile(contract, 'contract.sol.tpl', 'sol', {
|
||||
const filePath = this._generateFile(contract, 'contract.sol.hbs', 'sol', {
|
||||
'contractName': contract.className,
|
||||
'structName': contract.className + "Struct",
|
||||
'fields': Object.keys(contract.fields).map(f => {
|
||||
|
|
Loading…
Reference in New Issue