【发布时间】:2018-02-22 06:17:47
【问题描述】:
我在一个项目中使用 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 here 并获取报告。
有什么方法可以使用 gulp 生成 HTML 报告?
如果您认为这个问题对未来的读者有帮助,欢迎您开始赏金。
【问题讨论】:
标签: google-chrome gulp lighthouse