简体   繁体   English

在构建期间打印出Grunt.js配置

[英]Print out Grunt.js config during the build

I'd like to really learn how Grunt is working and be able to debug it later. 我想真正了解Grunt是如何工作的,并能够在以后调试它。 How do I print out all of the configuration Grunt has at a given time? 如何打印出Grunt在给定时间内的所有配置? I'd like to see the merging of .initConfig, the package file, and any task level configuration. 我想看看.initConfig,包文件和任何任务级别配置的合并。

You can print out the grunt configuration by setting up a grunt task like this: 您可以通过设置如下的grunt任务来打印出grunt配置:

grunt.registerTask('printConfig', function() {
  grunt.log.writeln(JSON.stringify(grunt.config(), null, 2));
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM