Skip to content

Commit

Permalink
prettier --write '**/*.js'
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed May 13, 2021
1 parent 0faa563 commit b32fdf7
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions lib/subsetFonts.js
Expand Up @@ -720,11 +720,8 @@ async function subsetFonts(
}

for (const htmlAssetTextsWithPropsEntry of htmlAssetTextsWithProps) {
const {
htmlAsset,
textByProps,
accumulatedFontFaceDeclarations,
} = htmlAssetTextsWithPropsEntry;
const { htmlAsset, textByProps, accumulatedFontFaceDeclarations } =
htmlAssetTextsWithPropsEntry;
htmlAssetTextsWithPropsEntry.fontUsages = groupTextsByFontFamilyProps(
htmlAsset,
globalTextByProps,
Expand All @@ -735,9 +732,8 @@ async function subsetFonts(

if (omitFallbacks) {
for (const htmlAsset of htmlAssets) {
const accumulatedFontFaceDeclarations = fontFaceDeclarationsByHtmlAsset.get(
htmlAsset
);
const accumulatedFontFaceDeclarations =
fontFaceDeclarationsByHtmlAsset.get(htmlAsset);
// Remove the original @font-face rules:
for (const { relations } of accumulatedFontFaceDeclarations) {
for (const relation of relations) {
Expand Down Expand Up @@ -811,8 +807,9 @@ async function subsetFonts(
} of htmlAssetTextsWithProps) {
for (const fontUsage of fontUsages) {
if (fontUsage.subsets) {
const characterSet = fontkit.create(Object.values(fontUsage.subsets)[0])
.characterSet;
const characterSet = fontkit.create(
Object.values(fontUsage.subsets)[0]
).characterSet;

let missedAny = false;
for (const char of [...fontUsage.pageText]) {
Expand Down Expand Up @@ -1294,9 +1291,8 @@ These glyphs are used on your site, but they don't exist in the font you applied
// Lazy load the original @font-face declarations of self-hosted fonts (unless omitFallbacks)
const originalRelations = new Set();
for (const htmlAsset of htmlAssets) {
const accumulatedFontFaceDeclarations = fontFaceDeclarationsByHtmlAsset.get(
htmlAsset
);
const accumulatedFontFaceDeclarations =
fontFaceDeclarationsByHtmlAsset.get(htmlAsset);
// TODO: Maybe group by media?
const containedRelationsByFontFaceRule = new Map();
for (const { relations } of accumulatedFontFaceDeclarations) {
Expand Down Expand Up @@ -1414,12 +1410,13 @@ These glyphs are used on your site, but they don't exist in the font you applied
googleFontStylesheetRelation.to.url
);
if (!selfHostedGoogleFontsCssAsset) {
selfHostedGoogleFontsCssAsset = await createSelfHostedGoogleFontsCssAsset(
assetGraph,
googleFontStylesheetRelation.to,
formats,
hrefType
);
selfHostedGoogleFontsCssAsset =
await createSelfHostedGoogleFontsCssAsset(
assetGraph,
googleFontStylesheetRelation.to,
formats,
hrefType
);
subsetFontsToBeMinified.add(selfHostedGoogleFontsCssAsset);
selfHostedGoogleCssByUrl.set(
googleFontStylesheetRelation.to.url,
Expand Down Expand Up @@ -1485,9 +1482,8 @@ These glyphs are used on your site, but they don't exist in the font you applied
cssRule.value.includes('var(')
) {
if (!customPropertyDefinitions) {
customPropertyDefinitions = findCustomPropertyDefinitions(
cssAssets
);
customPropertyDefinitions =
findCustomPropertyDefinitions(cssAssets);
}
for (const customPropertyName of extractReferencedCustomPropertyNames(
cssRule.value
Expand Down

0 comments on commit b32fdf7

Please sign in to comment.