Loading global scss variables in nextjs with sass preprendData
Recently I started using next.js and slowly diving into lower levels of web design, creating own components, managing complexer styles etc.
One of the things I realized was that I want to use a CSS preprocessor, so I went for dart sass but sticking to .scss as file format.
The one thing that annoyed me - and took me some time to solve - was how to use react with modular styles i.e. component.module.scss but having a central _variables.scss containing colors, common element widths.
I have seen approaches that require custom loaders or organizing my stylesheets in a certain way.
Finally I found out that dart sass can be configured to append data to every stylesheet before parsing it.



