diff --git a/README.md b/README.md index 856ff68c..b03d28f5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/transform.ts b/src/transform.ts index ffb82fe4..7c464f5e 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -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 */ @@ -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)) ||