-1

I've searched around but I cant seem to find an answer.. say I have a project and In my project I have a few .scss files like mixins.scss, vars.scss and base.scss now obviously I will want to use these files in my component .scss file.. is there a way I can import all of these one time and then use them throughout my project.. Its seem stupid that on every .scss file I have I need to write 6 import statements.. now Ive tried to add those files directly to the angular-cli.json file as well as importing them in my main styles.scss file but neither of those methods worked

Any help would be appreciated!

EDIT

Ive managed to find a work around by putting all my imports into a main.scss file but surely there has to be a better way!

Smokey Dawson
  • 8,827
  • 19
  • 77
  • 152

1 Answers1

1

You can use webpack's require.context feature to require all of the files in a folder. Here's an answer with a solution for that.

requireAll(require.context('./styles/', true, /\.scss$/))
kingdaro
  • 11,528
  • 3
  • 34
  • 38