-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
When using sass, how to import sass variables? #1619
Comments
one way to do it is just import any scss file from your root so rather than placing
in and |
@viankakrisna thanks, this works! :) |
Couldn't you also |
Closing with 67d0d49. |
As always, @gaearon comments is an eye opener 👍 @grundmanise please use this instead of my suggestion. It's more inline with component based structure. |
No, I don’t know how to solve this aside from moving them into an npm package and then using |
You can use sass-resources-loader to load global variables into every sass file before output. In addition to the other style loaders for scss files in your webpack config: |
Getting hit with an error when trying to use Error Message
My code
|
You can also load the styles into a root component and pass them down as props, but maybe that is just a React Native strategy, I'm not certain. I will just mention it anyway for the more savage yet creative individuals. It can facilitate theming your app by swapping out variables at the root level, perhaps based on user-preferences. |
@woniesong92 npm package seems to work for me, also have very deeply nested files |
@bengrunfeld you're missing a semicolon on your |
Any new suggestions? |
Hi, first of all thanks for such a great react development setup & build automation tool.
When using
create-react-app
withnode-sass
. How to exposesass
variables to my project? Can't get my head around..My folder structure for the reference:
The text was updated successfully, but these errors were encountered: