我在开发过程中打开了两个选项卡(一个带有应用程序,另一个带有jasmine测试套件)。
因此,我有两个浏览器化包(看起来像这段代码),因此,我需要使用两个gulp-livereload实例。我就是这样做的:
var livereloadTestSuite = require('gulp-livereload');
var livereloadDeveloperSuite = require('gulp-livereload'); // port 35728
appBundler.bundle()
.on('error', gutil.log)
.pipe(source('application.js'))
.pipe(gulpif(!options.development, streamify(uglify())))
.pipe(gulp.dest(options.dest))
.pipe(gulpif(options.development, livereloadDeveloperSuite())) // this line
.pipe(notify(function () {
console.log('APP bundle built in ' + (Date.now() - start) + 'ms');
}));
testBundler.bundle()
.on('error', gutil.log)
.pipe(source('specs.js'))
.pipe(gulp.dest('./build/'))
.pipe(livereloadTestSuite())
.pipe(notify(function () {
console.log('TEST bundle built in ' + (Date.now() - start) + 'ms');
}));
gulp.task('default', ['buildDependencies'], function () {
livereloadTestSuite.listen();
livereloadDeveloperSuite.listen({ port: 35728, host: 'localhost' });
// calling bundler & testBundler methods茉莉花测试套件
<script src="http://localhost:35729/livereload.js?snipver=1"></script>而app测试套件有这一行
<script src="http://localhost:35728/livereload.js?snipver=1"></script>Jasmine测试套件在它的重绑定上成功地重新加载,但是开发套件根本没有重新加载。我不知道如何解决这个问题
发布于 2015-09-24 08:31:54
使用所需nodejs模块的remove缓存完成:
var livereloadTestSuite = require('gulp-livereload');
delete(require.cache[require.resolve('gulp-livereload')]);
var livereloadDeveloperSuite = require('gulp-livereload');https://stackoverflow.com/questions/32723280
复制相似问题