After spending some time on this, I am facing a challenge with my application setup. Currently, I have defined variables in the scss file for setting colors and I want to import these variables into Typescript to send them to servers.
My Angular component contains a lot of font and color strings which I thought of moving into a scss file for design purposes. However, I am struggling to retrieve the colors from there.
I have noticed that some people have achieved something similar in Javascript, but I haven't been able to replicate it in Typescript yet.
What I aim to accomplish is:
Scss:
:export { myVariable:#ffffff; }
NGTypescript:
import {styles} from "./styles.scss";
and then perform an operation like:
onPostRequest(){ let color = styles.myVariable; ... }
However, when I reach the import line mentioned above, I encounter an error stating: Cannot find module './icon-picker.component.scss'.ts(2307)
I have come across similar examples in React where this functionality is implemented, but I am finding it challenging to adapt it to Angular. The concepts discussed in https://github.com/css-modules/css-modules/issues/86 caught my attention. Additionally, this walkthrough in Javascript also seems to be dealing with similar issues: