I have three files:
- style.scss
- _mixins.scss
- _navigation.scss
obviously, in _mixins.scss
i have my mixins defined. In style.scss
i then import these mixins with @use ‘mixins’;. I now also have another partial called _navigation.scss
that i also imported into the main scss file using @use ‘navigation’;. I now want to use a mixin defined in the mixins partial, in the navigation partial. But when i try to do this i get an Error: Undefined mixin.
Is what i am trying to do not possible? If so, how would i use a mixin defined in _mixins.scss
in another partial?
It seems like you have a order problem. You should follow 7-1
folder structure and create a styles.scss
with following imports
@import 'mixins'
@import 'navigation' // Notice the order
This should get your styles working. Also, be sure that your bundler is bundling the scss properly.
Reference for folder structure – https://dev.to/dostonnabotov/a-modern-sass-folder-structure-330f#:~:text=There%20is%20a%20famous%207,into%20one%20big%20CSS%20file.
1