-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Built-in Sass Support for Global Stylesheets (Variables/Mixins.scss) #10912
Comments
You need to import your mixins, variables, etc in each *.module.scss file. I have global.scss file I use that includes all that and I import it at the top of every module file. You can use this code in your Next's config so you don't have to use relative paths:
PS The new version of Next that just dropped includes scss support without the plugin. It also changes this! |
I am using the new next js with the scss feature! But the variables and Mixins I don’t want to import it in each components. I want to use it globally so I can use the variables/functions throughout the project. I don’t want to use the next/scss since it is not needed anymore. Thanks, Kevin |
You can make your variables and mixins available globally by using the See this comment for a workaround. |
@OscarBarrett - So I have to do it that way regardless? |
I ended up doing this:
To allow global variables and mixins. Let me know what you guys think of this? Thank! |
Duplicate of #10339 |
@timneutkens - Is it really a duplicate though? Because I am implementing a feature that didn't exist during the time of the other ticket that is duplicate. |
It did exist at that time, it was just under an experimental flag and the person was using it |
@timneutkens Thank you for addressing the custom options in #11063. It looks like the And got:
|
@kkashou Did you find a solution ? |
@redaben - I used this example to work what I needed done #10339 (comment) |
Same problem with next 9.3 |
@timneutkens @yomed sorry im new to next but how exactly do I use the SCSS options mentioned in #11063 ? |
@abetoots You would put the options in module.exports = {
experimental: {
sassOptions: {
...
},
},
}; Note that |
@yomed So |
@abetoots |
@yomed Ah I see. I seem to have missed:
since I used |
Should be fixed via #12277 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
I have included my global.scss, mixins.scss and variables.scss to the _app.js file like mentioned in the documentations https://nextjs.org/blog/next-9-2#built-in-css-support-for-global-stylesheets but the problem I am facing is that I can leverage of the mixins or variables globally from the different components (*.module.scss) files. How can I make that happen?
I have removed the @zeit/next-css and @zeit/next-scss per the documentations to just use the built in scss support.
This is hte error I am getting:
Let me know if I am missing something else?
Thanks
The text was updated successfully, but these errors were encountered: