2

I use frontend-maven-plugin to build angular 2 project, and all its output is gathered into log file

How to avoid this attempts to color the output?

As far as I understand, this is webpack output. And it has an option to remove coloring --no-color (See https://webpack.github.io/docs/cli.html). But how to configure it withing angular-cli project?

[INFO] > ng build --prod --no-progress
[INFO] 
[INFO] Hash: [1mcdc28d05836bd99cad9b[39m[22m
[INFO] Time: [1m39010[39m[22mms
[INFO] chunk    {[1m[33m0[39m[22m} [1m[32mmain.57f471d45785d7eea4e1.bundle.js[39m[22m (main) 386 kB {[1m[33m2[39m[22m}[1m[33m [initial][39m[22m[1m[32m [rendered][39m[22m
[INFO] chunk    {[1m[33m1[39m[22m} [1m[32mstyles.5dc7cc9cc5c864bb207a.bundle.css[39m[22m (styles) 175 bytes {[1m[33m3[39m[22m}[1m[33m [initial][39m[22m[1m[32m [rendered][39m[22m
[INFO] chunk    {[1m[33m2[39m[22m} [1m[32mvendor.563a90a466766cc96494.bundle.js[39m[22m (vendor) 1.75 MB[1m[33m [initial][39m[22m[1m[32m [rendered][39m[22m
[INFO] chunk    {[1m[33m3[39m[22m} [1m[32minline.954a415d92a5e8ab9b9d.bundle.js[39m[22m (inline) 0 bytes[1m[33m [entry][39m[22m[1m[32m [rendered][39m[22m
kingoleg
  • 1,305
  • 15
  • 24

1 Answers1

2

AFAIK, that feature is not supported by angular-cli now.

But there is a temporary solution:

ng build | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" > log.txt

it's reference from https://github.com/angular/angular-cli/issues/6478#issuecomment-304276909 and here

And hope it would be supported natively by angular-cli soon :).

e-cloud
  • 4,331
  • 1
  • 23
  • 37