The structure of my directories is as follows:
stylesheets
..modules
...._all.scss
...._colors.scss
..partials
...._all.scss
...._Home.scss
..main.scss
In the _Home.scss
file, I have the following:
@import '../modules/all';
.headerStyle {
color: pink;
font-size: 15;
font-weight: 500;
}
In the main.scss
file, I import all the _all.scss
files in the stylesheets folder like this:
@import 'modules/all'
@import 'partials/all'
html { font-family: 'Roboto', sans-serif; }
body {
margin: 0;
background-color: orange
}
When importing the stylesheet in my component, I simply do:
import '../../stylesheets/main.scss'
...
<div className="headerStyle">Header</div>
However, the .headerStyle
styling from _Home.scss
is not being applied to the <div>
in the component. I have verified the directory path to main.scss
and there are no errors present.
Currently, only the styles applied in the body
block are being displayed:
body {
margin: 0;
background-color: orange
}
What could I possibly be doing wrong? Is there a more effective way to import stylesheets into a component without having to redefine it each time for a component?
Thank you in advance for your assistance, and I appreciate any help given.