[ci] yarn format
This commit is contained in:
parent
2f349cbabf
commit
b5623ada16
2 changed files with 7 additions and 8 deletions
|
@ -124,31 +124,30 @@ export async function bundleCSS({
|
||||||
const newHref = cssMap.get(oldHref);
|
const newHref = cssMap.get(oldHref);
|
||||||
|
|
||||||
if (!newHref) {
|
if (!newHref) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el.attribs?.rel === 'preload') {
|
if (el.attribs?.rel === 'preload') {
|
||||||
if (preloads.has(newHref)) {
|
if (preloads.has(newHref)) {
|
||||||
$(el).remove();
|
$(el).remove();
|
||||||
} else {
|
} else {
|
||||||
$(el).attr("href", cssHashes.get(newHref) || "");
|
$(el).attr('href', cssHashes.get(newHref) || '');
|
||||||
preloads.add(newHref);
|
preloads.add(newHref);
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stylesheets.has(newHref)) {
|
if (stylesheets.has(newHref)) {
|
||||||
$(el).remove(); // this is a dupe; remove
|
$(el).remove(); // this is a dupe; remove
|
||||||
} else {
|
} else {
|
||||||
$(el).attr("href", cssHashes.get(newHref) || ""); // new CSS; update href (important! use cssHashes, not cssMap)
|
$(el).attr('href', cssHashes.get(newHref) || ''); // new CSS; update href (important! use cssHashes, not cssMap)
|
||||||
|
|
||||||
// bonus: add [rel] and [type]. not necessary, but why not?
|
// bonus: add [rel] and [type]. not necessary, but why not?
|
||||||
$(el).attr("rel", "stylesheet");
|
$(el).attr('rel', 'stylesheet');
|
||||||
$(el).attr("type", "text/css");
|
$(el).attr('type', 'text/css');
|
||||||
|
|
||||||
stylesheets.add(newHref);
|
stylesheets.add(newHref);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
(buildState[id] as any).contents = $.html(); // save updated HTML in global buildState
|
(buildState[id] as any).contents = $.html(); // save updated HTML in global buildState
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,7 +14,7 @@ const EXPECTED_CSS = {
|
||||||
'/one/index.html': ['/_astro/common-', '/_astro/one/index-'],
|
'/one/index.html': ['/_astro/common-', '/_astro/one/index-'],
|
||||||
'/two/index.html': ['/_astro/common-', '/_astro/two/index-'],
|
'/two/index.html': ['/_astro/common-', '/_astro/two/index-'],
|
||||||
'/preload/index.html': ['/_astro/common-', '/_astro/preload/index-'],
|
'/preload/index.html': ['/_astro/common-', '/_astro/preload/index-'],
|
||||||
'/preload-merge/index.html': ['/_astro/preload-merge/index-']
|
'/preload-merge/index.html': ['/_astro/preload-merge/index-'],
|
||||||
};
|
};
|
||||||
const UNEXPECTED_CSS = ['/_astro/components/nav.css', '../css/typography.css', '../css/colors.css', '../css/page-index.css', '../css/page-one.css', '../css/page-two.css'];
|
const UNEXPECTED_CSS = ['/_astro/components/nav.css', '../css/typography.css', '../css/colors.css', '../css/page-index.css', '../css/page-one.css', '../css/page-two.css'];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue