Hey there, I've got a question that's been on my mind. I really enjoy using SCSS in React, but for the longest time, I steered clear of variables and mixins because dealing with imports after making changes was a complete nightmare for me (I had a separate SCSS file for each component).
But then I stumbled upon a solution - I could easily create absolute paths in React imports like this:
import "src/scss/variables"
Now, I'm back to feeling excited about exploring all the amazing features SCSS has to offer.
So here's my question - can I create a single global.scss file and use only this file throughout my whole app when importing styles into different SCSS files? For example, the global.scss file would have contents similar to this:
@use "variables"
@use "mixins"
@use "functions"
@forward "variables"
@forward "mixins"
@forward "functions"
And in the components.scss file, I would simply import it like this:
@use "src/scss/global"
.test {
background-color: global.$primary-color;
}
Another thing I'm curious about is whether it's possible for these globals to be imported just once in the main.jsx or app.jsx files and then automatically utilized in all other files within the project?