【发布时间】:2014-04-21 21:29:59
【问题描述】:
我在我的 wordpress 环境中运行了一个基本的 gulp.js 设置。除了我重新加载更改的 .php 文件的方式之外,一切都按我的意愿进行。当 gulp 完成运行任务时,它似乎正在加载任务两次,这意味着它将开始 - 完成任务然后再次重新运行任务。我让 gulp 观看的文件位于根目录以及库目录中。另外,有没有办法让 gulp 只查找更改的文件。我是这样设置的:
// PHP TASK
gulp.task(‘php’, function () {
watch({glob:['.php','library/.php']})
.pipe(plugins.livereload(server))
.pipe(plugins.notify({ message: ‘PHP task complete’ }));
});
// Watch
gulp.task(‘watch’, function() {
// Listen on port 35729
server.listen(35729, function (err) {
if (err) {
return console.log(err)
};
// Watch php files
gulp.watch(['php']);
});
});
// Default task
gulp.task(‘default’, ['php', 'watch']);
======================================
这是一次保存的结果。
[gulp] index.php was reloaded.
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
[gulp] index.php was reloaded.
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
… Reload /Users/jfearing/Sites/zurb/wp-content/themes/JointsWP-CSS-master/index.php …
【问题讨论】: