When using sass, how to import sass variables?
See original GitHub issueHi, first of all thanks for such a great react development setup & build automation tool.
When using create-react-app
with node-sass
. How to expose sass
variables to my project? Can’t get my head around…
My folder structure for the reference:
└───src
├───app
│ └───variables.scss // here are all my vars
├───components
│ └───Header // there is Header.scss in this folder, where I need to use my variables
├───helpers
├───public
└───utils
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >css - SASS - use variables across multiple files - Stack Overflow
You need to import (using @use ) the partial SASS file into each SASS file that uses it - not just your main...
Read more >SASS | Use variables across multiple files - GeeksforGeeks
To import multiple sass partials with @import by adding @import followed by first filename within quotes then comma(, ) then followed by second ......
Read more >Sass @import and Partials - W3Schools
You can create small files with CSS snippets to include in other Sass files. Examples of such files can be: reset file, variables,...
Read more >Variables in @import · Issue #279 · sass/sass - GitHub
@niklas-r, if you're trying to import an .scss file from Bower, you should store bower_components outside of your Sass subfolder and add path...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Couldn’t you also
@import "../../variables.scss";
or equivalent from any component’s Sass file that needs them?one way to do it is just import any scss file from your root
index.scss
so rather than placing
import './Header.css';
inHeader.js
You doin
index.scss
and
import './index.css'
inindex.js