[ci] yarn format

This commit is contained in:
FredKSchott 2021-09-13 18:12:51 +00:00 committed by GitHub Actions
parent 2f349cbabf
commit b5623ada16
2 changed files with 7 additions and 8 deletions

View file

@ -124,31 +124,30 @@ export async function bundleCSS({
const newHref = cssMap.get(oldHref);
if (!newHref) {
return
return;
}
if (el.attribs?.rel === 'preload') {
if (preloads.has(newHref)) {
$(el).remove();
} else {
$(el).attr("href", cssHashes.get(newHref) || "");
$(el).attr('href', cssHashes.get(newHref) || '');
preloads.add(newHref);
}
return
return;
}
if (stylesheets.has(newHref)) {
$(el).remove(); // this is a dupe; remove
} 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?
$(el).attr("rel", "stylesheet");
$(el).attr("type", "text/css");
$(el).attr('rel', 'stylesheet');
$(el).attr('type', 'text/css');
stylesheets.add(newHref);
}
});
(buildState[id] as any).contents = $.html(); // save updated HTML in global buildState
})

View file

@ -14,7 +14,7 @@ const EXPECTED_CSS = {
'/one/index.html': ['/_astro/common-', '/_astro/one/index-'],
'/two/index.html': ['/_astro/common-', '/_astro/two/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'];