如何避免 gulp 任务日志中的转义字符?
How to avoid escape characters in gulp task logs?
这是创建的 Gulp 个日志:
[Info],Code repository head matched with CodeTagId:,21.00.01.08,for GradeITCode repository
[Info],Content repository head matched with ContentTagId:,21.00.01.08,for PCTContent repository.
git rev-parse HEAD (log : false),
[Info],Code repository head matched with CodeTagId:,21.00.01.08,for PCTCode >repository.
Finished,'[36mValidateConfigParams[39m',after,[35m2.15s[39mStarting,'[36mcleanPackageLocation[39m'...
[Info],Cleaning Package Location Started
[Info],Cleaning Package Location complete
Finished,'[36mcleanPackageLocation[39m',after,[35m1.4 min[39m
Starting,'[36mbuildGradeIT[39m'...
[36m 和 [39m 是需要删除的特殊字符,仅出现在完成和开始日志中。
原生stdout.write和console.log已被覆盖。
最终证明是 Chalk.js 插入的字符,它为控制台上的日志提供了颜色。
当 Stdout 函数被覆盖时,字符被打印在日志文件中。
chalk.stripColor(string) 结果是我的解决方案。
这是创建的 Gulp 个日志:
[Info],Code repository head matched with CodeTagId:,21.00.01.08,for GradeITCode repository
[Info],Content repository head matched with ContentTagId:,21.00.01.08,for PCTContent repository.
git rev-parse HEAD (log : false),
[Info],Code repository head matched with CodeTagId:,21.00.01.08,for PCTCode >repository.
Finished,'[36mValidateConfigParams[39m',after,[35m2.15s[39mStarting,'[36mcleanPackageLocation[39m'...
[Info],Cleaning Package Location Started
[Info],Cleaning Package Location complete
Finished,'[36mcleanPackageLocation[39m',after,[35m1.4 min[39m
Starting,'[36mbuildGradeIT[39m'...
[36m 和 [39m 是需要删除的特殊字符,仅出现在完成和开始日志中。
原生stdout.write和console.log已被覆盖。
最终证明是 Chalk.js 插入的字符,它为控制台上的日志提供了颜色。
当 Stdout 函数被覆盖时,字符被打印在日志文件中。
chalk.stripColor(string) 结果是我的解决方案。