CodeWringer / strive-foundryVTT

STRIVE system for FoundryVTT
GNU General Public License v3.0
1 stars 0 forks source link

Extract template literals from templates #181

Closed CodeWringer closed 6 months ago

CodeWringer commented 1 year ago

Often times, in Handlebars templates, String literals are used to reference other templates. These literals should be extracted to the corresponding view model, as a getter. An alternative would be providing a handlebars partial to reference.

An example to look at would be the skill-item-sheet.hbs file.

For example:

skill-item-sheet-viewmodel.mjs

get templateSkillAbilityTable() { return TEMPLATES.SKILL_ABILITY_TABLE; }

skill-item-sheet.hbs

{{> (viewModel.templateSkillAbilityTable) [...]}}

OR

skill-ability-table-viewmodel.mjs

Handlebars.registerPartial('skillAbilityTable', `{{> "${SkillAbilityTableViewModel.TEMPLATE}"}}`);

skill-item-sheet.hbs

{{> "skillAbilityTable" [...]}}