dazeh's avatar
Level 1

Correct method for importing modules to my style sheets (laravel mix)

So I will give you a scenario.

I have 2 scss files. One (file A) has 10 imports from different modules from my node_modules folder and the other (file B) has simple styling for an internal page only for logged in users which i don't want imported to my public css file.

When importing the likes of bootstrap in file A I obviously cannot access it in file B. But if in file B I wanted to use variables from bootstrap I would need to import bootstrap again. Which in turn means I have 2 bootstrap imports. Thus repeating myself.

Using laravel mix and researching this problem everyone say its best to import all of my modules via @import in my main app.scss file.

I took this has creating a file C and importing file C into A and B but doesn't this just create the same problem I mentioned above?

Can someone shine light on the best practise for this scenario please.

0 likes
0 replies

Please or to participate in this conversation.