-
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.
* fix: enable emotion cache * fix: update favicon to use new boxed logo as svg
- Loading branch information
Showing
4 changed files
with
69 additions
and
2 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 +1,19 @@ | ||
import createCache from '@emotion/cache'; | ||
|
||
const isBrowser = typeof document !== 'undefined'; | ||
|
||
// On the client side, Create a meta tag at the top of the <head> and set it as insertionPoint. | ||
// This assures that MUI styles are loaded first. | ||
// It allows developers to easily override MUI styles with other styling solutions, like CSS modules. | ||
export default function createEmotionCache() { | ||
return createCache({ key: 'css', prepend: true }); | ||
let insertionPoint: HTMLElement | undefined; | ||
|
||
if (isBrowser) { | ||
const emotionInsertionPoint: HTMLElement | null = document.querySelector( | ||
'meta[name="emotion-insertion-point"]', | ||
); | ||
insertionPoint = emotionInsertionPoint ?? undefined; | ||
} | ||
|
||
return createCache({ key: 'mui-style', insertionPoint }); | ||
} |