我正在为一个项目使用 gulp,并在 gulp 任务中添加了灯塔,如下所示:
gulp.task("lighthouse", function(){
return launchChromeAndRunLighthouse('http://localhost:3800', flags, perfConfig).then(results => {
console.log(results);
});
});
这是我的launchChromeAndRunLighthouse()函数
function launchChromeAndRunLighthouse(url, flags = {}, config = null) {
return chromeLauncher.launch().then(chrome => {
flags.port = chrome.port;
return lighthouse(url, flags, config).then(results =>
chrome.kill().then(() => results));
});
}
它在命令行中为我提供了 json 输出。我可以在这里发布我的 json并获取报告。
有什么方法可以使用gulp生成 HTML 报告?
如果您认为这个问题对未来的读者有帮助,欢迎您开始赏金。