-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Font cleanup: remove index from next so font loading is not trigger eroneously cleaned up /next dir move BannerBlock out of this package (it's specific to sites/market)
- Loading branch information
1 parent
dc194d7
commit 9b2533f
Showing
15 changed files
with
40 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ export { | |
} from './types' | ||
|
||
export * from './primitives' | ||
export * from './next' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Next related Lux helpers | ||
|
||
### no `index.ts` file, and `load-and-return-lux-next-fonts-on-import.ts` | ||
|
||
Next font loading requires the fonts to be assigned to const's in module scope (ie, loaded when the module is evaluated, exactly once). | ||
|
||
If there was an `index.ts` "barrel file", and the client code imported anything from this package, it would have resulted in evaluting all the packages imported including the that loaded the fonts. Without the index, the client code knows what modules import it and thus when it happens. | ||
|
||
tl;dr: See [this article from Vercel](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js) about this issue. | ||
|
||
(Previously, not having this safegaurd caused a serious bug becuase the fonts were loaded far too early.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
import fontDescs from './lux-next-fonts' | ||
import nextFonts from './load-and-return-lux-next-fonts-on-import' | ||
import type NextFontDesc from './next-font-desc' | ||
|
||
// These will be injected for <body> in app router app that uses our RootLayout | ||
|
||
// First is assumed to be mapped to the default font and is injected into <body> | ||
// as a normal tw font family class. | ||
export default () => { | ||
let nextFonts: NextFontDesc[] = [] | ||
fontDescs.forEach((desc: NextFontDesc) => { | ||
if (desc.nextFont) { | ||
nextFonts.push(desc) | ||
} | ||
}) | ||
return nextFonts.map( | ||
(desc: NextFontDesc) => (desc.nextFont!.variable) | ||
).join(' ') + ` font-${nextFonts[0].twName}` | ||
} | ||
export default () => ( | ||
nextFonts.map( | ||
(desc: NextFontDesc) => (desc.nextFont!.variable) | ||
).join(' ') + ` font-${nextFonts[0].twName}` | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters