File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ export async function getFontFaceDeclarations(options: LoaderOptions) {
7272 if ( "fontReferenceId" in localFontSrc ) {
7373 return dedent `@font-face {
7474 font-family: ${ id } ;
75- src: url(${ localFontSrc . fontReferenceId ? getPlaceholderFontUrl ( localFontSrc . fontReferenceId ) : `/@fs${ localFontSrc . fontPath } ` } )
75+ src: url(${ localFontSrc . fontReferenceId ? getPlaceholderFontUrl ( localFontSrc . fontReferenceId ) : `/@fs/${ localFontSrc . fontPath } ` } );
76+ ${ weight ? `font-weight: ${ weight } ;` : "" }
77+ ${ style ? `font-style: ${ style } ;` : "" }
7678 ${ fontDeclarations }
7779 }` ;
7880 }
@@ -86,7 +88,7 @@ export async function getFontFaceDeclarations(options: LoaderOptions) {
8688 . map ( ( font ) => {
8789 return dedent `@font-face {
8890 font-family: ${ id } ;
89- src: url(${ font . path . fontReferenceId ? getPlaceholderFontUrl ( font . path . fontReferenceId ) : `/@fs${ font . path . fontPath } ` } );
91+ src: url(${ font . path . fontReferenceId ? getPlaceholderFontUrl ( font . path . fontReferenceId ) : `/@fs/ ${ font . path . fontPath } ` } );
9092 ${ font . weight ? `font-weight: ${ font . weight } ;` : "" }
9193 ${ font . style ? `font-style: ${ font . style } ;` : "" }
9294 ${ fontDeclarations }
Original file line number Diff line number Diff line change @@ -15,7 +15,12 @@ export function getCSSMeta(options: Options) {
1515 .${ className } {
1616 font-family: ${ options . fontFamily } ;
1717 ${ isNextCSSPropertyValid ( options . styles ) ? `font-style: ${ options . styles [ 0 ] } ;` : "" }
18- ${ isNextCSSPropertyValid ( options . weights ) ? `font-weight: ${ options . weights [ 0 ] } ;` : "" }
18+ ${
19+ isNextCSSPropertyValid ( options . weights ) &&
20+ ! options . weights [ 0 ] ?. includes ( " " )
21+ ? `font-weight: ${ options . weights [ 0 ] } ;`
22+ : ""
23+ }
1924 }
2025
2126 ${
@@ -39,7 +44,9 @@ export function getCSSMeta(options: Options) {
3944function getClassName ( { styles, weights, fontFamily } : Options ) {
4045 const font = fontFamily . replaceAll ( " " , "-" ) . toLowerCase ( ) ;
4146 const style = isNextCSSPropertyValid ( styles ) ? styles [ 0 ] : null ;
42- const weight = isNextCSSPropertyValid ( weights ) ? weights [ 0 ] : null ;
47+ const weight = isNextCSSPropertyValid ( weights )
48+ ? weights [ 0 ] ?. replaceAll ( " " , "-" )
49+ : null ;
4350
4451 return `${ font } ${ style ? `-${ style } ` : "" } ${ weight ? `-${ weight } ` : "" } ` ;
4552}
You can’t perform that action at this time.
0 commit comments