Commit 7114a0e 1 parent 01288ea commit 7114a0e Copy full SHA for 7114a0e
File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ const options = {
54
54
resolvePath : (id ) => ' file:///path/to/public/dir' + id,
55
55
// overrideName: (originalName) => `${name} override`
56
56
// sourcemap: false
57
+ // skipFontFaceGeneration: (fontFamily) => fontFamily === 'Roboto'
57
58
}
58
59
59
60
// Vite
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ interface FontaineTransformOptions {
17
17
css ?: { value ?: string }
18
18
fallbacks : string [ ]
19
19
resolvePath ?: ( path : string ) => string | URL
20
+ skipFontFaceGeneration ?: ( name : string ) => boolean
20
21
/** this should produce an unquoted font family name */
21
22
fallbackName ?: ( name : string ) => string
22
23
/** @deprecated use fallbackName */
@@ -34,6 +35,9 @@ export const FontaineTransform = createUnplugin(
34
35
const fallbackName =
35
36
options . fallbackName || options . overrideName || generateFallbackName
36
37
38
+ const skipFontFaceGeneration =
39
+ options . skipFontFaceGeneration || ( ( ) => false )
40
+
37
41
function readMetricsFromId ( path : string , importer : string ) {
38
42
const resolvedPath =
39
43
isAbsolute ( importer ) && path . startsWith ( '.' )
@@ -62,6 +66,7 @@ export const FontaineTransform = createUnplugin(
62
66
for ( const { family, source } of parseFontFace ( matchContent ) ) {
63
67
if ( ! family ) continue
64
68
if ( ! supportedExtensions . some ( e => source ?. endsWith ( e ) ) ) continue
69
+ if ( skipFontFaceGeneration ( family ) ) continue
65
70
66
71
const metrics =
67
72
( await getMetricsForFamily ( family ) ) ||
You can’t perform that action at this time.
0 commit comments