我正在构建一个Gruntfile.js。 我正在尝试创建响应php请求的任务。
其他任务包括实时编译指南针/ sass和实时重载。 我遇到了一个有趣的障碍:
当我开始咕噜咕噜时,我可以在终端中看到监视任务正在运行,并且php服务器正在运行:我在终端收到有关某些文件没有到位的消息。
现在发生了事情......在我开始咕噜声后几秒钟,firefox窗口开始打开。 (我在没有运行firefox的情况下启动任务。我通常使用铬和铬)。
新窗口继续打开。关于firefox崩溃的ff消息有时会弹出。我也会弹出窗口告诉我,我的ff配置文件无法访问 - 如果我在ff已经运行时尝试从终端运行'firefox',这就是我所期望的。
他们不停地弹出,直到我停止咕噜声跑。当我通过终端上的Ctrl-c停止任务时,它们都会立即关闭。
导致这种情况的原因是什么?
这是我的gruntfile
module.exports = function (grunt){
grunt.initConfig({
compass : {
dist : {
options : {
cssDir : 'css',
sassDir : 'sass',
debugInfo : true
}
}
},
php :{
dist : {
options : {
keepalive : true,
port: 9000
}
},
watch : {
files : ['*.html', '*.php', 'js/*', 'sass/*', 'css/*'],
tasks : ['compass'],
options : {
livereload: true
}
}
},
});
grunt.loadNpmTasks('grunt-php');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('default', ['php', 'watch']) ;
} ;
答案 0 :(得分:0)
您的watch
任务指定您要使用livereload
- 所以,那是(某种)预期的,对吗?
见这里: