Speed up webpage testing time

Testing web pages can be really time consuming. Every CSS, HTML or image change needs a browser refresh. It would be way better if the reloads could be avoided.

Comments

There are some available editors/IDEs that offer this specific functionality. Check Brackets' live preview (http://brackets.io/). Otherwise, I find the solution here really cool and with a nice explanation.
Savvas Yiannopoulos - Fri, 11/23/2018 - 18:57 :::
It might be considered a hack, but it has its place. Even !important is just another tool in the toolbox. As long as it does its job consistently everything is fine
Klaus Nigsch - Sun, 11/25/2018 - 13:05 :::
Disregard my comment please! I happened to post it in the wrong place and cannot delete it for some reason.
Klaus Nigsch - Sun, 11/25/2018 - 13:06 :::
Nice solution and well explained. I should use this. Testing web pages is really time consuming. Thank you for sharing and for the detailed explanation.
Malbora Sinaj - Sun, 12/09/2018 - 16:54 :::
Very interesting solution, I will also definitely be using this! Thank you!
Daria Piacun - Mon, 12/10/2018 - 10:43 :::
2 answers

Browsersync is an automation tool that can watch files for changes and inject them into a web page without reload.

Usage:

  • Install Node.js
  • Install Browsersync
    npm install -g browser-sync
  • Start Browsersync
    browser-sync start --proxy "myproject.dev" --files "css/*.css"

Browsersync will create a proxy that will wrap your vhost myproject.dev with a proxy URL.

It can also be used with gulp:

var browserSyncWatchFiles = [
'./style.css',
'./js/*.min.js',
'./*.php'
];
var browserSync = require('browser-sync').create();
var browserSyncOptions = {
proxy: "myproject.dev",
notify: false
};
gulp.task('browser-sync', function () {
browserSync.init(browserSyncWatchFiles, browserSyncOptions);
});

Nice little trick you showed :)

Taggings: