Using Styled-Jsx with SASS in NextJs
If you want to use SASS in styled-jsx
tags in your nextjs projects, follow the steps below.
First create a nextjs project if it doesn't exist.
npm init next-app
# or
yarn create next-app
Then install the styled-jsx-plugin-sass
and node-sass
packages.
npm install --save-dev styled-jsx-plugin-sass node-sass
Create a file named .babelrc in the project directory you are working in and type and save the following
{
"presets": [
[
"next/babel",
{
"styled-jsx": {
"plugins": ["styled-jsx-plugin-sass"]
}
}
]
]
}
Restart the next server. You can now start using your sass codes in <style jsx>.
Comments
Popular Articles
Popular Tags
- #directive
- #Function
- #Json
- #Class
- #SASS
- #Form
- #Redirect
- #API
- #Special Characters
- #Special
- #Random
- #Generating
- #
- #Text
- #Ajax
- #URL
- #Encrypting
- #React
- #Show
- #timeAgo
- #PSR-4
- #Hide
- #DDOS Protection
- #DDOS
- #cURL
- #Logic For Displaying Posts
- #Error
- #Key
- #General Error
- #1364 Field
- #Abbreviation
- #Blade
- #Version
- #QR
- #QR Code Generating
- #Array
- #Arrays with Key Values to String Statement
- #Short Tag
- #Activate
- #Real Time
- #Socket.io
- #301
- #Custom Directives
- #Iframe Detection
- #Date
- #Characters
- #Insert
- #Autoloader
- #Composer
- #Reading
There are no comments, make the firs comment