我一直在尝试为我的报道报告启用 livereload。我生成此报告的工具是karma-coverage,我在以下文件夹中生成此报告:test/coverage/html-report
-test
|
|-- coverage
|
|-- report-html
|
|-- index.html
生成报告后,我使用grunt-contrib-connect并使用以下内容提供生成的报告:
var COVERAGE_BASE = './test/coverage/report-html',
...
...
...
connect: {
server: {
options: {
port: 9000,
base: '.',
open: false
}
},
dist:{
options: {
keepalive: true,
port: 9000,
base: './dist',
open: false
}
},
coverage: {
options: {
keepalive: true,
port: 9001,
base: COVERAGE_BASE ,
open: false
}
}
}
当我执行我的任务grunt coverage
时,我的配置是
COVERAGE_TASKS = ['shell:test','open:coverage', 'connect:coverage','watch'];
grunt.registerTask('coverage', COVERAGE_TASKS);
我的想法是“拦截” index.html 并注入一个脚本来 livereload
<script src="//localhost:35729/livereload.js"></script>
在与连接包一起服务并处理它以添加此脚本之前,是否存在某种方法来拦截 index.html?