Add Hot Module Replacement for SVG icons using the custom component

This commit is contained in:
Oliver-Akins 2024-04-12 23:23:42 -06:00
parent f15f3a4456
commit fde3881653
2 changed files with 29 additions and 9 deletions

View file

@ -3,8 +3,8 @@ import * as hbs from "../handlebars.mjs";
const loaders = {
svg(data) {
const iconName = data.path.split(`/`).slice(-1)[0].slice(0, -4);
console.log(`.dungeon | hot-reloading icon: ${iconName}`);
CONFIG.CACHE.icons[iconName] = data.content;
console.debug(`.dungeon | hot-reloading icon: ${iconName}`);
Hooks.call(`dd-hmr:svg`, iconName, data);
},
hbs(data) {
if (!hbs.partials.some(p => data.path.endsWith(p))) {