Using global scss variables in my components styles.
angular-cli: 1.0.0-beta.6 node: 6.2.1 os: darwin x64
Hi I have bootstrap override varaibles.scss, which I want to use as a Global style for my app.
So, I depend on these variables on every component.scss I write. Is there a way I can add a global dependency of variables.scss.
Right now I do import the variables.scss manually in every scss file that require.
I can't believe how difficult Angular makes using SASS. I'm about to switch to React/webpack
this is ONE OF THE MOST COMMON THINGS I CAN IMAGINE. How can you get that wrong?!
also: you can make this work easily via webpack and sass-loader itself. Man it would be great if ng cli offered a way to extend the webpack conf out of the box. Like Vue does.
Guys this is how sass/scss works and has nothing todo with Angular. Just import your variables and you are good to go OR use a global stylesheets file.
So, in conclusion, if you @import something but you doesn't use a var or mixing of that thing you've imported, it isn't included in the final bundle, right?
Is there a way to use sass variables globally without the need to manually import in every single component? Perhaps this would be bad practice anyway as every component then has access, even if t doesn't need it...
Do one thing. It will work.
import variable.scss file in the component where you want to use variables, it will work.
This is not standard, if something standard arrives, it is easily undo-able.
What if i want separate css bundles, that i can switch at runtime, each bundle using its own _variables.scss?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.