Unverified Commit 5d992a6a authored by Phattarapol L's avatar Phattarapol L Committed by GitHub

Add Scss variables section to Built-in CSS Support document (#29822)



## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes
parent ca062db2
...@@ -181,6 +181,34 @@ module.exports = { ...@@ -181,6 +181,34 @@ module.exports = {
} }
``` ```
### Sass Variables
Next.js supports Sass variables exported from CSS Module files.
For example, using the exported `primaryColor` Sass variable:
```scss
/* variables.module.scss */
$primary-color: #64FF00
:export {
primaryColor: $primary-color
}
```
```js
// pages/_app.js
import variables from '../styles/variables.module.css'
export default function MyApp({ Component, pageProps }) {
return (
<Layout color={variables.primaryColor}>
<Component {...pageProps} />
</Layout>
)
}
```
## CSS-in-JS ## CSS-in-JS
<details> <details>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment