【发布时间】:2014-03-07 07:24:40
【问题描述】:
我正在构建一个 Gruntfile.js。 我正在尝试创建响应 php 请求的任务。
其他任务包括实时编译 compass/sass 和实时重新加载。 我遇到了一个有趣的问题:
当我启动 grunt 时,我可以在终端中看到监视任务正在运行,并且 php 服务器正在运行:我在终端中收到有关某些文件未到位的消息。
现在事情是这样的……在我开始咕噜咕噜几秒钟后,firefox 窗口开始打开。 (我在启动任务时根本没有运行firefox。我一般使用chromium和chrome)。
新窗口不断打开。有时会弹出有关 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']) ;
} ;
【问题讨论】:
标签: gruntjs