feat: automatically apply asset caching to img src and srcset (#184)

This commit is contained in:
Sylvain Cau
2022-05-19 19:19:59 +02:00
committed by GitHub
parent c1a9d53b18
commit e8b1e229b3
11 changed files with 254 additions and 50 deletions
+8 -1
View File
@@ -1,4 +1,5 @@
import { ComponentType, h, render } from "./deps.ts";
import { ComponentType, h, options, render } from "./deps.ts";
import { assetHashingHook } from "./utils.ts";
function createRootFragment(
parent: Element,
@@ -61,3 +62,9 @@ export function revive(islands: Record<string, ComponentType>) {
}
walk(document.body);
}
const originalHook = options.vnode;
options.vnode = (vnode) => {
assetHashingHook(vnode);
if (originalHook) originalHook(vnode);
};