-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Next plugin - pages router style loading (#1365)
- Loading branch information
1 parent
03ba50d
commit ed67731
Showing
12 changed files
with
135 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@vanilla-extract/next-plugin': minor | ||
--- | ||
|
||
Pages router: use next-style-loader in dev, output css in ssr |
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,12 @@ | ||
import * as styles from './features.css'; | ||
import testNodes from '../test-nodes.json'; | ||
|
||
export default ` | ||
<div id="${testNodes.mergedStyle}" class="${styles.mergedStyle}">Merged style</div> | ||
<div id="${testNodes.styleWithComposition}" class="${styles.styleWithComposition}">Style with composition</div> | ||
<div id="${testNodes.styleVariantsWithComposition}" class="${styles.styleVariantsWithComposition.variant}">Style variants with composition</div> | ||
<div id="${testNodes.styleVariantsWithMappedComposition}" class="${styles.styleVariantsWithMappedComposition.variant}">Style variants with mapped composition</div> | ||
<div id="${testNodes.compositionOnly}" class="${styles.compositionOnly}">Composition only</div> | ||
<div id="${testNodes.styleCompositionInSelector}" class="${styles.styleCompositionInSelector}">Style composition in selector</div> | ||
<div id="${testNodes.styleVariantsCompositionInSelector}" class="${styles.styleVariantsCompositionInSelector.variant}">Style variants composition in selector</div> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import html from '@fixtures/features/src/html'; | ||
|
||
export default function Features() { | ||
return ( | ||
<> | ||
<span id="features" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/sprinkles/src/html'; | ||
|
||
export default function Sprinkles() { | ||
return ( | ||
<> | ||
<span id="sprinkles" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/features/src/html'; | ||
|
||
export default function Features() { | ||
return ( | ||
<> | ||
<span id="features" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/sprinkles/src/html'; | ||
|
||
export default function Sprinkles() { | ||
return ( | ||
<> | ||
<span id="sprinkles" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,28 @@ | ||
import { | ||
sprinkles, | ||
mapResponsiveValue, | ||
normalizeResponsiveValue, | ||
preComposedSprinkles, | ||
preComposedSprinklesUsedInSelector, | ||
container, | ||
} from './styles.css'; | ||
import testNodes from '../test-nodes.json'; | ||
|
||
export default ` | ||
<div id="${testNodes.root}" class="${container}"> | ||
<div class="${sprinkles({ | ||
display: normalizeResponsiveValue('block').mobile, | ||
paddingTop: mapResponsiveValue( | ||
{ | ||
mobile: 'small', | ||
desktop: 'medium', | ||
} as const, | ||
(x) => x, | ||
), | ||
})}"> | ||
Sprinkles | ||
</div> | ||
<div class="${preComposedSprinkles}">Precomposed sprinkles</div> | ||
<div class="${preComposedSprinklesUsedInSelector}">Precomposed Sprinkles Used In Selector</div> | ||
</div> | ||
`; |
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,32 +1,7 @@ | ||
import { | ||
sprinkles, | ||
mapResponsiveValue, | ||
normalizeResponsiveValue, | ||
preComposedSprinkles, | ||
preComposedSprinklesUsedInSelector, | ||
container, | ||
} from './styles.css'; | ||
import testNodes from '../test-nodes.json'; | ||
import html from './html'; | ||
|
||
function render() { | ||
document.body.innerHTML = ` | ||
<div id="${testNodes.root}" class="${container}"> | ||
<div class="${sprinkles({ | ||
display: normalizeResponsiveValue('block').mobile, | ||
paddingTop: mapResponsiveValue( | ||
{ | ||
mobile: 'small', | ||
desktop: 'medium', | ||
} as const, | ||
(x) => x, | ||
), | ||
})}"> | ||
Sprinkles | ||
</div> | ||
<div class="${preComposedSprinkles}">Precomposed sprinkles</div> | ||
<div class="${preComposedSprinklesUsedInSelector}">Precomposed Sprinkles Used In Selector</div> | ||
</div> | ||
`; | ||
document.body.innerHTML = html; | ||
} | ||
|
||
render(); |
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