Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b5b8cd86
Unverified
Commit
b5b8cd86
authored
May 02, 2020
by
Robin Weser
Committed by
GitHub
May 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[example-with-fela] CSS imports compatibility (#12237)
parent
e5bcfdc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
25 deletions
+11
-25
package.json
examples/with-fela/package.json
+6
-6
_document.js
examples/with-fela/pages/_document.js
+5
-19
No files found.
examples/with-fela/package.json
View file @
b5b8cd86
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
"start"
:
"next start"
"start"
:
"next start"
},
},
"dependencies"
:
{
"dependencies"
:
{
"fela"
:
"
^10.2.4
"
,
"fela"
:
"
latest
"
,
"fela-dom"
:
"
^10.2.4
"
,
"fela-dom"
:
"
latest
"
,
"fela-preset-web"
:
"
^10.2.4
"
,
"fela-preset-web"
:
"
latest
"
,
"next"
:
"latest"
,
"next"
:
"latest"
,
"react"
:
"
^16.8.6
"
,
"react"
:
"
latest
"
,
"react-dom"
:
"
^16.8.6
"
,
"react-dom"
:
"
latest
"
,
"react-fela"
:
"
^10.2.4
"
"react-fela"
:
"
latest
"
}
}
}
}
examples/with-fela/pages/_document.js
View file @
b5b8cd86
import
Document
,
{
Head
,
Main
,
NextScript
}
from
'next/document'
import
Document
,
{
Main
,
NextScript
}
from
'next/document'
import
{
renderToSheetList
}
from
'fela-dom'
import
{
renderToNodeList
}
from
'react-fela'
import
getFelaRenderer
from
'../getFelaRenderer'
import
getFelaRenderer
from
'../getFelaRenderer'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
...
@@ -13,31 +14,16 @@ export default class MyDocument extends Document {
...
@@ -13,31 +14,16 @@ export default class MyDocument extends Document {
})
})
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
s
heetList
=
renderToSheet
List
(
renderer
)
const
s
tyles
=
renderToNode
List
(
renderer
)
return
{
return
{
...
initialProps
,
...
initialProps
,
s
heetList
,
s
tyles
:
[...
initialProps
.
styles
,
...
styles
]
,
}
}
}
}
render
()
{
render
()
{
const
styleNodes
=
this
.
props
.
sheetList
.
map
(
({
type
,
rehydration
,
support
,
media
,
css
})
=>
(
<
style
dangerouslySetInnerHTML
=
{{
__html
:
css
}}
data
-
fela
-
id
=
""
data
-
fela
-
rehydration
=
{
rehydration
}
data
-
fela
-
support
=
{
support
}
data
-
fela
-
type
=
{
type
}
key
=
{
`
${
type
}
-
${
media
}
`
}
media
=
{
media
}
/
>
)
)
return
(
return
(
<
html
>
<
html
>
<
Head
>
{
styleNodes
}
<
/Head
>
<
body
>
<
body
>
<
Main
/>
<
Main
/>
<
NextScript
/>
<
NextScript
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment