Ayman Jitan Ayman Jitan - 1 year ago 180
Sass (Sass) Question

How to pre-load SASS custom utilities (variables and mixins) with webpack

I am loading my utilities and assets in

like so

@import "_variables";
@import "_mixins";

I have tons of modules in my application and we are doing so many changes in these modules.

so importing the
in the header of each of the scss files is causing so much trouble and seems very redundant.

I tried using sass's includePaths but it didn't help as it only resolves the @import declarations.

Is there any way that I can auto import my utilities without having to @import it manually in each file?

Answer Source

This loader will do the job
by adding this to your webpack config

sassResources: [ './path/to/vars.scss', './path/to/mixins.scss' ]


check the implementation out in action in this boilerplate

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download