Next.js Discord

Discord Forum

Seeking Guidance on Using Sass Variables in a Next.js Project

Unanswered
Crested Myna posted this in #help-forum
Open in Discord
Crested MynaOP
Hey everyone,

I'm currently working on a Next.js project where I've organized my styles using SCSS. In the project, I have an "abstract" folder containing a _variables.scss file with various Sass variables.

I'm encountering some difficulties when it comes to using these Sass variables across my components. I've tried to import the _variables.scss file in my main styles.scss and use the variables within my component styles. However, I keep getting an error that says "$variable-name is not defined."

If anyone has experience with using Sass variables from an "abstract" folder in a Next.js project, I'd greatly appreciate your guidance and any examples you could provide. I'm eager to resolve this issue and make my project more maintainable.

Thank you for your help in advance! 🙏

2 Replies