Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update font-stylesheet-gathering-plugin.ts #30709

Merged
merged 5 commits into from Feb 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -13,6 +13,7 @@ import {
FONT_MANIFEST,
OPTIMIZED_FONT_PROVIDERS,
} from '../../../shared/lib/constants'
import * as Log from '../../output/log'

function minifyCss(css: string): Promise<string> {
return postcss([
Expand Down Expand Up @@ -197,11 +198,18 @@ export class FontStylesheetGatheringPlugin {
const css = await fontDefinitionPromises[promiseIndex]

if (css) {
const content = await minifyCss(css)
this.manifestContent.push({
url: fontStylesheets[promiseIndex],
content,
})
try {
const content = await minifyCss(css)
this.manifestContent.push({
url: fontStylesheets[promiseIndex],
content,
})
} catch (err) {
Log.warn(
`Failed to minify the stylesheet for ${fontStylesheets[promiseIndex]}. Skipped optimizing this font.`
)
console.error(err)
}
}
}

Expand Down