Skip to content

Commit

Permalink
fix: use more descriptive parameter for skipFontFaceGeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 8, 2023
1 parent 18b71e6 commit e38a9a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const options = {
resolvePath: (id) => 'file:///path/to/public/dir' + id,
// overrideName: (originalName) => `${name} override`
// sourcemap: false
// skipFontFaceGeneration: (fontFamily) => fontFamily === 'Roboto'
// skipFontFaceGeneration: (fallbackName) => fallbackName === 'Roboto override'
}

// Vite
Expand Down
4 changes: 2 additions & 2 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface FontaineTransformOptions {
css?: { value?: string }
fallbacks: string[]
resolvePath?: (path: string) => string | URL
skipFontFaceGeneration?: (name: string) => boolean
skipFontFaceGeneration?: (fallbackName: string) => boolean
/** this should produce an unquoted font family name */
fallbackName?: (name: string) => string
/** @deprecated use fallbackName */
Expand Down Expand Up @@ -66,7 +66,7 @@ export const FontaineTransform = createUnplugin(
for (const { family, source } of parseFontFace(matchContent)) {
if (!family) continue
if (!supportedExtensions.some(e => source?.endsWith(e))) continue
if (skipFontFaceGeneration(family)) continue
if (skipFontFaceGeneration(fallbackName(family))) continue

const metrics =
(await getMetricsForFamily(family)) ||
Expand Down

0 comments on commit e38a9a2

Please sign in to comment.