[英]Is it possible to have more than one reporter & reporterOutput in jshint?
In my options, I have a reporter and reporterOutput defined on my grunt task for jshint. 在我的选项中,我为jshint的grunt任务定义了一个reporter和reporterOutput。 But I'd like to write out two files from the same data.
但是我想从同一数据中写出两个文件。 Is it possible with jshint using the options or do I just need to define 2 grunt tasks that will do the same thing but output different formats of the same results?
jshint是否可以使用这些选项,还是我只需要定义2个grunt任务,它们将执行相同的操作,但是输出相同结果的不同格式?
I also want to do the same thing with jscs output. 我也想对jscs输出做同样的事情。
In your custom reporter, in order to create the output file you just return the following code: 在您的自定义报告程序中,为了创建输出文件,您只需返回以下代码:
process.stdout.write(reportHtmlJS);
Let's imagine reporterHTMLJS is your custom HTML output. 让我们想象一下reporterHTMLJS是您的自定义HTML输出。 What you can do before that is just use that HTML and create a second file, before the JSHint or JSCS module creates it.
在此之前,您可以做的只是在JSHint或JSCS模块创建HTML之前,使用该HTML并创建第二个文件。 Something similar to that:
类似于以下内容:
fs = require('fs');
fs.writeFile("./jshint/secondJSHintReport.html", reportHtmlJS, function (err) {
if (err) {
console.log(err);
}
});
You can also use some Grunt module, like grunt-contrib-copy and grunt-contrib-rename , and create new grunt task that will execute first jshint/jscs and then copy the file and rename it. 您还可以使用一些Grunt模块,例如grunt-contrib-copy和grunt-contrib-rename ,并创建新的grunt任务,该任务将首先执行jshint / jscs,然后复制文件并重命名。
grunt.task.run("jshint copy:jshint rename:jshint");
grunt.task.run("jscs copy:jscs rename:jscs");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.