0

Can anyone help me to add styles using webpack configuration> I searched in many places, but didn't get proper answer .


I need it using sass loading.

I am new to angular2 and webpack too

Please help me?

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Manikanta Reddy
  • 849
  • 9
  • 23

2 Answers2

0
styles: [require('pathToCss/function.component.scss')]

also , in vendor.ts :

import './assets/css/style.scss';
Alexis Le Gal
  • 327
  • 4
  • 11
0

You can use only styles and require your stylesheet with webpack styles:[require ('yourStyleSheet')]

NOTE:- due to an issue you have to use toString on required style

styles: [require("./app.styles.css").toString()]

Here is my github repo which use the same Note:- if you have used required you do not need to import it as the other answer mentioned because webpack will bundle it for you.

Jorawar Singh
  • 7,463
  • 4
  • 26
  • 39