Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other GULP Refresh

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #168392
    Jack
    Participant

    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 …

    #168531
    Jack
    Participant

    Sorry about that and thanks for the link. While looking through your source code, I was wondering how you handle PHP file refreshing?

    #186291

    Hi 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

    #186301
    shaneisme
    Participant

    Here’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.

    #186345
    Alen
    Participant

    I use LiveReload (Chrome Extension) and I just watch the files. Here’s my Gulp file if it helps.

    @718_bkqns

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.