Minimal working example for a character sheet
This commit is contained in:
parent
08a8b89ec0
commit
e5c1cfec97
11 changed files with 91 additions and 31 deletions
32
module/handlebars.js
Normal file
32
module/handlebars.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
export async function registerHandlebarsHelpers() {
|
||||
Handlebars.registerHelper({
|
||||
"dotdungeon-array": createArray
|
||||
});
|
||||
};
|
||||
|
||||
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",
|
||||
];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
console.debug(`Loaded ${partials.length} partials`);
|
||||
console.groupEnd();
|
||||
return loadTemplates(paths);
|
||||
};
|
||||
|
||||
|
||||
function createArray(...args) {
|
||||
return args.slice(0, -1);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue