Is there a way to use the built-in sass in Angular2 components?

I have an Angular 2 project based on webpack startup ( https://github.com/AngularClass/angular2-webpack-starter ). I am trying to figure out how to use sass directly in components (without calling an external .scss file). All the examples I found use styleUrls and the extension name “.scss” to find out when to call the Sass loader.

+6
source share
1 answer

Use sass-loader: require("!raw-loader!sass-loader!./file.scss"); this returns the compiled CSS from file.scss, allows the import of SASS.

styles: '//SASS style' - , SASS sass-loader. :

import styles from './styles.sass';
@Component({
  styles: styles
})
0

Source: https://habr.com/ru/post/1014696/


All Articles