next.js
next.js copied to clipboard
Nextjs and sass @extend
What version of Next.js are you using?
11
What version of Node.js are you using?
14.17.4
What browser are you using?
Chrome
What operating system are you using?
Windows 10
How are you deploying your application?
dev
Describe the Bug
Nextjs doesn't support sass @extend properly in .module.scss files.
Expected Behavior
I should be able to use styles\globals.scss
.centerTransform {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
class in pages\settings\some-module.scss via @extend
.someClass {
@extend .centerTransform;
}
To Reproduce
Check the ongoing discussion in this "closed" issue.
https://github.com/vercel/next.js/issues/10475
You can achieve it by using import at the beginning of your .module.scss file
@import '../../styles/globals.scss';
.myClass {
@extend .centerTransform;
}
I'm using Next.js v12.3.1 and still unable to use @extend of Sass.
I still can't use the SCSS @extend with v13.4.19.