10

ng serve compiles my app, but when I'm inspecting the html, the source of the CSS seems to be (style)...(/style). Does anybody knows how to configure sass source map via Angular-CLI ?

Nir Krevner
  • 241
  • 3
  • 6
  • https://www.codementor.io/stevebelovarich/compiling-sass-postcss-with-angular-cli-du107x931 – anshuVersatile Jan 23 '17 at 14:19
  • @anshuVersatile that post is now out of date (according to the author in the post comments) – hellsgate Mar 14 '17 at 09:58
  • Possible duplicate of [How to Source Map Angular CLI css files in Chrome Dev Tools?](https://stackoverflow.com/questions/40162982/how-to-source-map-angular-cli-css-files-in-chrome-dev-tools) – Francesco Borzi Aug 16 '17 at 15:55

1 Answers1

9

When you type ng serve by default angular cli doesn't include sourcemaps files for css files but you can include it by typing this command

ng serve -sm -ec

or

ng serve --sourcemap --extractCss

I use Angular Cli -v 1.0.3, and More information - Angular CLI special cases

Perhaps, its help you.

msanford
  • 11,803
  • 11
  • 66
  • 93
Serhiy Koziuk
  • 696
  • 6
  • 7
  • on AngularCLI 1.3.0 `ng serve -sm -ec` **works**, but `ng serve --sourcemap --extractCss` doesn't. – Francesco Borzi Aug 16 '17 at 15:53
  • Hi, ShinDarth. Very strange. I updated AngularCLI 1.3.2 and all works. – Serhiy Koziuk Sep 07 '17 at 13:22
  • It's not camel case. It's --extract-css – phip1611 Jan 26 '18 at 18:01
  • @phip1611 : there are multiple aliases : --extract-css (Boolean) Extract css from global styles onto css files instead of js ones. aliases: -ec, --extractCss – Saad Benbouzid Aug 29 '18 at 16:15
  • Per comment in https://stackoverflow.com/a/40224003/3232832, seems as of Dec 2018, NG CLI still cannot properly link to the exact / original SCSS line. However, with the method in this answer, it can at least show you the right line of CSS, which can then be searched for. – ryanm Dec 04 '18 at 16:56