Move dev-only hooks into their own folder that isn't included in the build
This commit is contained in:
parent
8de63e91c7
commit
803c1673e2
7 changed files with 37 additions and 4 deletions
15
dev/hooks/getHeaderControlsActorSheetV2.mjs
Normal file
15
dev/hooks/getHeaderControlsActorSheetV2.mjs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
This hook exists to be able to change all of the actor-sheets to allow
|
||||
them to have dev-mode controls in their header that are useful for
|
||||
testing purposes. (This is particularly useful for testing embedded
|
||||
items that are only allowed to exist on specific actor types)
|
||||
*/
|
||||
Hooks.on(`getHeaderControlsActorSheetV2`, (_app, controls) => {
|
||||
if (!game.settings.get(`ripcrypt`, `devMode`)) { return }
|
||||
|
||||
controls.push({
|
||||
icon: `fa-solid fa-terminal`,
|
||||
label: `Embed New Item (DEV)`,
|
||||
action: `createItem`,
|
||||
});
|
||||
});
|
||||
16
dev/hooks/hotReload.mjs
Normal file
16
dev/hooks/hotReload.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { Logger } from "../../module/utils/Logger.mjs";
|
||||
|
||||
const loaders = {
|
||||
svg(data) {
|
||||
const iconName = data.path.split(`/`).slice(-1)[0].slice(0, -4);
|
||||
Logger.debug(`hot-reloading icon: ${iconName}`);
|
||||
Hooks.call(`${game.system.id}-hmr:svg`, iconName, data);
|
||||
},
|
||||
mjs() {window.location.reload()},
|
||||
css() {window.location.reload()},
|
||||
};
|
||||
|
||||
Hooks.on(`hotReload`, async (data) => {
|
||||
if (!loaders[data.extension]) {return}
|
||||
return loaders[data.extension](data);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue