- This topic is empty.
-
AuthorPosts
-
April 21, 2014 at 1:21 pm #168392JackParticipant
I have a basic gulp.js setup running in my wordpress environment. Everything works how I would like except for the way I am reloading my changed .php files. When gulp finishes running the task it seems to be loading the task twice meaning that it will start-finish the task then re-run the task again. The files I had gulp watching are located in the root directory as well as the library directory. Also, is there a way to have gulp only look for changed files. I have it set up like this:
// 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’]);====================================
Here is the result form a single save.
[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 …April 23, 2014 at 4:03 pm #168531JackParticipantSorry about that and thanks for the link. While looking through your source code, I was wondering how you handle PHP file refreshing?
October 15, 2014 at 7:01 am #186291Historical Forums UserParticipantHi Shane,
I have a site I am working on which depends on some PHP/MSQL, so naturally I am using MAMP locally, but i want to implement my gulp workflow. Would it be simply watch the php, and point the gulp server/livereload to the same server/port MAMP is using?
Jack, I hope I didn’t bogart your question I figured it was kind of similar.
Antonio
October 15, 2014 at 7:49 am #186301shaneismeParticipantHere’s a tut for you: http://robandlauren.com/2014/02/05/live-reload-grunt-wordpress/
It involves registering the script inside WP. Hope that does it for ya.
October 15, 2014 at 8:17 pm #186345 -
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.