Fix preload for Firefox

main
Mike Fix 6 years ago
parent ded88c2e40
commit b19bbf26ae

@ -10,6 +10,9 @@ const CDN_STYLESHEETS = THEMES.filter(
t => t.hasStylesheet !== false && LOCAL_STYLESHEETS.indexOf(t.id) < 0 t => t.hasStylesheet !== false && LOCAL_STYLESHEETS.indexOf(t.id) < 0
) )
// as="style"
// onLoad="this.onload=null;this.rel='stylesheet'"
export default function Meta() { export default function Meta() {
const onBrowser = typeof window !== 'undefined' const onBrowser = typeof window !== 'undefined'
return ( return (
@ -38,44 +41,27 @@ export default function Meta() {
<title>Carbon</title> <title>Carbon</title>
<link rel="manifest" href="/static/manifest.json" /> <link rel="manifest" href="/static/manifest.json" />
<link rel="shortcut icon" href="/static/favicon.ico" /> <link rel="shortcut icon" href="/static/favicon.ico" />
<link <link rel="stylesheet" href="/static/react-crop.css" />
rel="preload"
as="style"
onLoad="this.onload=null;this.rel='stylesheet'"
href="/static/react-crop.css"
/>
<link <link
rel="stylesheet" rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.min.css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.min.css"
/> />
<link <link
rel="preload" rel="stylesheet"
as="style"
onLoad="this.onload=null;this.rel='stylesheet'"
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.30.0/theme/solarized.min.css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.30.0/theme/solarized.min.css"
/> />
<link <link
rel="preload" rel="stylesheet"
as="style"
onLoad="this.onload=null;this.rel='stylesheet'"
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/theme/seti.min.css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/theme/seti.min.css"
/> />
{LOCAL_STYLESHEETS.map(id => ( {LOCAL_STYLESHEETS.map(id => (
<link <link key={id} rel="stylesheet" href={`/static/themes/${id}.css`} />
key={id}
rel="preload"
as="style"
onLoad="this.onload=null;this.rel='stylesheet'"
href={`/static/themes/${id}.css`}
/>
))} ))}
{onBrowser {onBrowser
? CDN_STYLESHEETS.map(theme => ( ? CDN_STYLESHEETS.map(theme => (
<link <link
key={theme.id} key={theme.id}
rel="preload" rel="stylesheet"
as="style"
onLoad="this.onload=null;this.rel='stylesheet'"
href={ href={
theme.link || theme.link ||
`//cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/theme/${theme.id}.min.css` `//cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/theme/${theme.id}.min.css`

Loading…
Cancel
Save