Dart SASS can't see outside of the /src folder. Why is this?

18 Views Asked by At

Dart SASS can't see outside of the /src folder. Why is this?

I have my /node_modules folder at the root of my solution, i.e. next to package.json

All of my development files I put in the /src folder

My SASS files go in the /src/sass folder

I have some dependencies, e.g. Bootstrap, OpenProps and Font Awesome. These live in the root /node_modules folder.

I can't however include Bootstrap from my /src/sass/style.scss. It refuses to see it. i.e. this doesn't work

@import "/node_modules/bootstrap/scss/functions";
@import "~node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/functions";

Therefore I have to copy and paste my dependencies in a new src/ folder one by one to use them in SASS and then I have to access them with relative links, e.g.

@import "../node_modules/bootstrap/scss/functions";

But this seems crazy to me? It means that I have to have more than one node_modules folder for SASS compilation to work. What am I missing? How do other people do this?

I just want a simple set-up, where I have a list of all my dependencies and versions in package.json and that SASS can see the root /node_modules folder.

I don't want to have to create secondary copies of the node_modules folder to in my /src to put the dependencies I use in. That seems really ridiculous. I've been searching for an answer for this for years. Any help you can give would be gratefully received.

0

There are 0 best solutions below