Reputation: 61
I've tried several ways to import an scss file from another directory and it didn't work, here's how the directory is organized:
--style ---pages ------_Home.scss ---utils ------_mixin.scss ------_variables.scss
I believe it should import like this (In _Home.scss
):
@import "..utils/mixin";
Upvotes: 0
Views: 2530
Reputation: 1691
Create a file in your utils folder named _index.scss Inside that file, type
@forward "variables";
@forward "mixin";
In your _home.scss file, at the top, type
@use '../utils' as *
Your variables and mixins will be available in _home
What I would do, as you are not showing all your directory, is create a main.scss file in the styles directory, then do this inside it
@use "utils/index";
@use "pages/Home";
Compile the main.scss file to css
Your utils folder should come before the pages folder
@Forward and @use replace @import
Upvotes: 2
Reputation: 141
Correct in the _pages.scss file the path to the file.
@import "../utils/mixin";
Upvotes: 0