Make it so that Handlebars partials get reloaded automatically
This commit is contained in:
parent
93b55df045
commit
dda38b6695
3 changed files with 45 additions and 11 deletions
|
|
@ -1,3 +1,10 @@
|
|||
export const partials = [
|
||||
"actors/char-sheet-mvp/partials/dice_choice.hbs",
|
||||
"actors/char-sheet-mvp/partials/stat.hbs",
|
||||
"actors/char-sheet-mvp/partials/skill.hbs",
|
||||
"actors/char-sheet-mvp/partials/panel.hbs",
|
||||
]
|
||||
|
||||
export async function registerHandlebarsHelpers() {
|
||||
Handlebars.registerHelper({
|
||||
"dotdungeon-array": createArray
|
||||
|
|
@ -7,20 +14,13 @@ export async function registerHandlebarsHelpers() {
|
|||
export async function preloadHandlebarsTemplates() {
|
||||
console.groupCollapsed(`.dungeon | Handlebars template loading`)
|
||||
const pathPrefix = `systems/dotdungeon/templates/`;
|
||||
const partials = [
|
||||
"actors/char-sheet-mvp/partials/dice_choice.hbs",
|
||||
"actors/char-sheet-mvp/partials/stat.hbs",
|
||||
"actors/char-sheet-mvp/partials/skill.hbs",
|
||||
"actors/char-sheet-mvp/partials/panel.hbs",
|
||||
];
|
||||
|
||||
const paths = {};
|
||||
|
||||
for ( const partial of partials ) {
|
||||
console.debug(`Loading partial: ${partial}`);
|
||||
const path = `${pathPrefix}${partial}`;
|
||||
paths[path] = path;
|
||||
paths[`dotdungeon.${path.split("/").pop().replace(".hbs", "")}`] = path;
|
||||
paths[`dotdungeon.${partial.split("/").pop().replace(".hbs", "")}`] = path;
|
||||
}
|
||||
|
||||
console.debug(`Loaded ${partials.length} partials`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue