How to use SASS/SCSS in angular application

后端 未结 4 1869
梦毁少年i
梦毁少年i 2021-01-16 09:51

I am trying to build a color theme functionality in angular2 application using sass. My header.component.scss file is:

$head-color: #f11;
h1{
    color: $hea         


        
4条回答
  •  醉话见心
    2021-01-16 10:26

    Instead of using styleUrls use styles and convert the file to a string.

    styles: [require('./header.component.scss').toString()]
    

    For your webpack config I think you have to many loaders. I believe you should be able to just have

    'raw-loader!sass-loader' 
    

    My current config is:

    {
      test: /\.scss$/,
      exclude: /node_modules/,
      loader: 'raw-loader!postcss-loader!sass-loader'
    },
    

提交回复
热议问题