Linty fresh
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
2026-02-01 00:22:52 -03:00
parent 9bf06d8cb0
commit 915d53fdba

View File

@@ -20,23 +20,23 @@ const DIST = path.join(ROOT, 'dist');
* Critters leaves rel="stylesheet" on swap links; change to rel="preload" as="style"
* so the full CSS loads async and only applies on load (non-blocking).
*/
function postProcessSwapLinks(html) {
return html.replace(/<link\s+([^>]*)>/gi, (full, attrs) => {
if (
!/rel="stylesheet"/i.test(attrs) ||
!/onload="this\.rel='stylesheet'"/i.test(attrs)
) {
return full;
}
const fixed = attrs
.replace(/\brel="stylesheet"\s*/i, 'rel="preload" as="style" ')
.replace(
/\bonload="this\.rel='stylesheet'"/i,
'onload="this.onload=null;this.rel=\'stylesheet\'"',
);
return `<link ${fixed}>`;
});
}
// function postProcessSwapLinks(html) {
// return html.replace(/<link\s+([^>]*)>/gi, (full, attrs) => {
// if (
// !/rel="stylesheet"/i.test(attrs) ||
// !/onload="this\.rel='stylesheet'"/i.test(attrs)
// ) {
// return full;
// }
// const fixed = attrs
// .replace(/\brel="stylesheet"\s*/i, 'rel="preload" as="style" ')
// .replace(
// /\bonload="this\.rel='stylesheet'"/i,
// 'onload="this.onload=null;this.rel=\'stylesheet\'"',
// );
// return `<link ${fixed}>`;
// });
// }
async function main() {
if (!fs.existsSync(DIST)) {