I have the following project structure:
gatsby-config.js
/src
/components
layout.jsx
/button
button.jsx
button.scss
/pages
/styles
styles.scss
_mixins.scss
_variables.scss
and gatsby-config.js
and styles.scss
are configured respectively in the following way:
...
plugins: [
...,
`gatsby-plugin-sass`
]
...
@import 'variables',
'mixins';
in order to access the mixins and variables, the styles.scss
is being currently imported in all the components' scss files, e.g.:
//button.scss
@import './../styles/styles.scss'
This approach is working, but the problem is, as the project grows, the styles.scss
is being imported multiple times and seems to be something wrong with this approach.
Is it possible to import styles.scss
only once, and make all mixins and variables available across all the components?