0

I am using the ng-cli build tool to assemble my Angular2 application.

I am using Sass to style my components. Within these sass files I would like to import some sass content from bootstrap.

I have achieved this by using a Sass @import using a relative path to the relevant bootstrap files underneath node_modules:

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

This is a bit cumbersome, and breaks if I change the directory structure of my components.

Is there a neater mechanism to import form node_modules without the relative path?


It seems like the sass property includePaths would allow me to state node_modules as an include path, and allow me to have the succinct import

@import "bootstrap/scss/_variables.scss";

How can I instruct ng-cli to configure Sass with includePaths?

jwa
  • 3,239
  • 2
  • 23
  • 54

1 Answers1

0

Try adding @import "~bootstrap/scss/_variables.scss" in your styles.scss

JSingh
  • 375
  • 1
  • 4
  • Welcome to StackOverflow and thanks for your help. You might want to make your answer even better by adding some explanation. – Kenzo_Gilead Sep 02 '17 at 22:15