inline the fonts
This commit is contained in:
parent
e91a52f1d8
commit
e9deeeb4db
2
deploy
2
deploy
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
rm -rf dist && nr build
|
rm -rf dist && nr build
|
||||||
curl https://deploy.arm.adam.id.au/client.mjs > /tmp/client.mjs
|
curl -q https://deploy.arm.adam.id.au/client.mjs > /tmp/client.mjs
|
||||||
DEPLOY_PATH=dist DEPLOY_PROJECT=homepage DEPLOY_CADDYFILE=Caddyfile node /tmp/client.mjs
|
DEPLOY_PATH=dist DEPLOY_PROJECT=homepage DEPLOY_CADDYFILE=Caddyfile node /tmp/client.mjs
|
||||||
|
@ -33,12 +33,7 @@ for (const [name, f] of Object.entries(fonts)) {
|
|||||||
const words = typeof selector === 'string' ? Array.from(doc.querySelectorAll(selector)).map(x => x.textContent).join(' ') : selector();
|
const words = typeof selector === 'string' ? Array.from(doc.querySelectorAll(selector)).map(x => x.textContent).join(' ') : selector();
|
||||||
|
|
||||||
const subset = await subsetFont(await readFile(path), words, { targetFormat: 'woff2' });
|
const subset = await subsetFont(await readFile(path), words, { targetFormat: 'woff2' });
|
||||||
const hash = makeHash(subset);
|
html = html.replace(`FONT_${name}_${weight}`, 'data:font/woff2;base64,' + subset.toString('base64'));
|
||||||
|
|
||||||
const outName = `static/${name}-${weight}.${hash}.woff2`;
|
|
||||||
|
|
||||||
html = html.replace(`FONT_${name}_${weight}`, outName);
|
|
||||||
await writeFile('dist/' + outName, subset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user