Andreas Dominguez
Andreas Dominguez

Reputation: 65

wordpress development flow: browser auto refresh

I want to optimimize my wordpress development flow. Is there a way to automatically refresh the browser when I save code in my text editor during wordpress dev. I am using MAMP for dev env. I am looking for something like gulp browserSync for a wordpress dev env.

Upvotes: 0

Views: 1487

Answers (3)

bhv
bhv

Reputation: 5378

install browser-sync ( nodejs required )

npm install browser-sync -g

and then use proxy to add your localhost address and then add files

browser-sync start --proxy "localhost" --files "*.php"

or

browser-sync start --proxy "localhost" --files "*.php, *.css, **/*.php, **/*.css"

Upvotes: 2

Sythe Veenje
Sythe Veenje

Reputation: 46

You can let the gulp-browsersync sync .php files as well.

// Add php extention to your gulp paths
var paths = {
  html: ['*.php', '*.html'],
};

// Then add paths to task
gulp.task('browser-sync', function() {
  browserSync.init({
    proxy: 'localhost/yourporject'
  });
});

// Execute on change
gulp.task('watch', function() {
  gulp.watch(paths.html).on('change', browserSync.reload);
});

Upvotes: 0

Dhaval Chheda
Dhaval Chheda

Reputation: 5147

I use netbeans IDE for WP development and you can run the code directly from there

click on green arrow at top then in the new window click on browser select your browser url :- enter http://localhost:8888/wordpress/

home page :- should be left blank

after this every time you hot the green arrow you will automatically be taken to the site.

Hope this helps

Take care and happy coding

Upvotes: 0

Related Questions