fix partial creation
This commit is contained in:
parent
75f3aff2c2
commit
3845777ba4
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,5 @@ node_modules/
|
|||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
test/testresult/
|
||||||
.nogit/
|
.nogit/
|
||||||
|
4
dist/smarthbs.helpers.js
vendored
4
dist/smarthbs.helpers.js
vendored
@ -5,7 +5,7 @@ plugins.handlebars.registerHelper('__analyze', (analyzeContext) => {
|
|||||||
if (typeof analyzeContext === 'string') {
|
if (typeof analyzeContext === 'string') {
|
||||||
if (plugins.handlebars.partials[analyzeContext]) {
|
if (plugins.handlebars.partials[analyzeContext]) {
|
||||||
plugins.beautylog.log(`The analyzed partial ${analyzeContext} looks like this`);
|
plugins.beautylog.log(`The analyzed partial ${analyzeContext} looks like this`);
|
||||||
console.log(plugins.handlebars.partials);
|
console.log(plugins.handlebars.partials[analyzeContext]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plugins.beautylog.error(`The Partial ${analyzeContext} cannot be found`);
|
plugins.beautylog.error(`The Partial ${analyzeContext} cannot be found`);
|
||||||
@ -21,4 +21,4 @@ plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationCont
|
|||||||
let template = plugins.handlebars.compile(evaluationString);
|
let template = plugins.handlebars.compile(evaluationString);
|
||||||
return template(evaluationContext);
|
return template(evaluationContext);
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw4Q0FBNkM7QUFFN0MsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsV0FBVyxFQUFFLENBQUMsY0FBYztJQUM1RCx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UFBO0lBQ3hDLE1BQU0sQ0FBQyxVQUFVLENBQUE7QUFDbkIsQ0FBQyxDQUFDLENBQUE7QUFFRixPQUFPLENBQUMsVUFBVSxDQUFDLGNBQWMsQ0FBQyxXQUFXLEVBQUUsQ0FBQyxnQkFBZ0IsRUFBRSxpQkFBaUI7SUFDakYsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtJQUMzRCxNQUFNLENBQUMsUUFBUSxDQUFDLGlCQUFpQixDQUFDLENBQUE7QUFDcEMsQ0FBQyxDQUFDLENBQUEifQ==
|
11
dist/smarthbs.partials.js
vendored
11
dist/smarthbs.partials.js
vendored
@ -10,14 +10,17 @@ exports.registerPartialDir = (dirPathArg) => {
|
|||||||
for (let hbsFilePath of hbsFileArrayArg) {
|
for (let hbsFilePath of hbsFileArrayArg) {
|
||||||
let parsedPath = plugins.path.parse(hbsFilePath);
|
let parsedPath = plugins.path.parse(hbsFilePath);
|
||||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath));
|
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath));
|
||||||
if (parsedPath.dir === '') {
|
if (parsedPath.dir === '/') {
|
||||||
parsedPath.name = '/' + parsedPath.name;
|
parsedPath.dir = '';
|
||||||
}
|
}
|
||||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`;
|
if (parsedPath.dir !== '') {
|
||||||
|
parsedPath.dir = parsedPath.dir + '/';
|
||||||
|
}
|
||||||
|
let partialName = `partials/${parsedPath.dir}${parsedPath.name}`;
|
||||||
plugins.handlebars.registerPartial(partialName, hbsFileString);
|
plugins.handlebars.registerPartial(partialName, hbsFileString);
|
||||||
done.resolve();
|
done.resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=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FBQyxDQUFDO2dCQUMzQixVQUFVLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQTtZQUNyQixDQUFDO1lBQ0QsRUFBRSxDQUFDLENBQUMsVUFBVSxDQUFDLEdBQUcsS0FBSyxFQUFFLENBQUMsQ0FBQyxDQUFDO2dCQUMxQixVQUFVLENBQUMsR0FBRyxHQUFHLFVBQVUsQ0FBQyxHQUFHLEdBQUcsR0FBRyxDQUFBO1lBQ3ZDLENBQUM7WUFDRCxJQUFJLFdBQVcsR0FBRyxZQUFZLFVBQVUsQ0FBQyxHQUFHLEdBQUcsVUFBVSxDQUFDLElBQUksRUFBRSxDQUFBO1lBQ2hFLE9BQU8sQ0FBQyxVQUFVLENBQUMsZUFBZSxDQUFDLFdBQVcsRUFBRSxhQUFhLENBQUMsQ0FBQTtZQUM5RCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUE7UUFDaEIsQ0FBQztJQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDckIsQ0FBQyxDQUFBIn0=
|
1
test/hbs_testfiles/index2.hbs
Normal file
1
test/hbs_testfiles/index2.hbs
Normal file
@ -0,0 +1 @@
|
|||||||
|
A second hbs file!
|
@ -1 +0,0 @@
|
|||||||
<head></head>analyzed
|
|
@ -9,10 +9,13 @@ export let registerPartialDir = (dirPathArg: string): Promise<any> => {
|
|||||||
for (let hbsFilePath of hbsFileArrayArg) {
|
for (let hbsFilePath of hbsFileArrayArg) {
|
||||||
let parsedPath = plugins.path.parse(hbsFilePath)
|
let parsedPath = plugins.path.parse(hbsFilePath)
|
||||||
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath))
|
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath))
|
||||||
if (parsedPath.dir === '') {
|
if (parsedPath.dir === '/') {
|
||||||
parsedPath.name = '/' + parsedPath.name
|
parsedPath.dir = ''
|
||||||
}
|
}
|
||||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`
|
if (parsedPath.dir !== '') {
|
||||||
|
parsedPath.dir = parsedPath.dir + '/'
|
||||||
|
}
|
||||||
|
let partialName = `partials/${parsedPath.dir}${parsedPath.name}`
|
||||||
plugins.handlebars.registerPartial(partialName, hbsFileString)
|
plugins.handlebars.registerPartial(partialName, hbsFileString)
|
||||||
done.resolve()
|
done.resolve()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user