4

I want to share some scss variables with my javascript.

So far I have done the following but it isn't working.

Component

import * as variables from 'sass-variable-loader!../styles/_variables.scss';

.angular.cli.json

...
"scripts": [
  "../node_modules/sass-variable-loader/dist/index.js"
],
...

I also change the typings.d.ts file to accept files ending in .scss.

I realize I'm not adding the sass-variable-loader to a webpack configuration but doesn't angular use that under the hood anyways? Is there a way for me to add the sass-variable-loader without out explicitly specifying it in a webpack configuration?

OR

Is there another way to load this file and share the variables with my typescript files?

EDIT

If I do import * as variables from '../styles/_variables.scss' then I get the error message Cannot find module from webpack during compilation.

christo8989
  • 6,442
  • 5
  • 37
  • 43

0 Answers0