diff --git a/scripts/critters.mjs b/scripts/critters.mjs index cb6e96e..9ed89a4 100644 --- a/scripts/critters.mjs +++ b/scripts/critters.mjs @@ -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(/]*)>/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 ``; - }); -} +// function postProcessSwapLinks(html) { +// return html.replace(/]*)>/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 ``; +// }); +// } async function main() { if (!fs.existsSync(DIST)) {