question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't reload a browser

See original GitHub issue

The plugin doesn’t reload a browser. In console it says [BS] Reloading Browsers... but nothing is reloaded. Neither it works with injected script tag, nor without. Nodemon works like a charm but not browser-sync. Here is my gulpfile.js:

var gulp = require('gulp'),
    gutil = require('gulp-util'),
    browserify = require('gulp-browserify'),
    nodemon = require('gulp-nodemon')
    compass = require('gulp-compass'),
    gulpif = require('gulp-if'),
    uglify = require('gulp-uglify'),
    // minifyHTML = require('gulp-minify-html'),
    concat = require('gulp-concat'),
    browserSync = require('browser-sync'),
    path = require('path');

var port,
    env,
    nodemonConf,
    scssSources,
    scssStyle,
    jsSources,
    templateSources,
    outputDir;

port = 3000;
env = 'development';

nodemonConf = {
    script: "index.js",
    ext: 'js html dust json scss',
    env: { 'NODE_ENV': env },
    nodeArgs: ['--debug']
}

if (env==='development') {
    scssStyle = 'expanded';
} else {
    scssStyle = 'compressed';
}

// browserSync({
//     port: 8000,
//     baseDir: "./"
// });

gulp.task('browser-sync', function() {
    browserSync({
        open: false,
        server: {
            baseDir: "./"
        }
    });
});

gulp.task('dev', function() {
    nodemon(nodemonConf)
        .on('restart', function () {
            browserSync.reload();
            console.log('== Restarted! ==');
        });
});

gulp.task('default', ["browser-sync", "dev"]);

I did as tutorial says. Why it doesn’t work?

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

34reactions
bravewickcommented, Jun 2, 2015

I figured it out. I was responding with just 200 (serverside) and that means no body tag for browser-sync to inject the script tag. @rjaguilar maybe you have similar issue ?

33reactions
ashishagaikwadcommented, Sep 7, 2016

check if your page has a body tag because browser-sync works only with files having body tag

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Ways to Force Refresh in Your Internet Browser - wikiHow
You can simply hit the refresh button in the top left corner (assuming you are using Safari). It looks like a circle with...
Read more >
Fix: My Browser's Refresh Button is Not Working - Technipages
Troubleshooting Your Browser's Refresh Button · 1. Perform a hard refresh · 2. Clear your browser history and cache · 3. Unplug your...
Read more >
Simple steps to refresh your web browser cache
Simply, On windows Press Ctrl+F5 and On Mac press Option+⌘ Command+E to empty your cache, and then ⌘ Command+R to refresh the page....
Read more >
How to Hard Refresh Your Web Browser (to Bypass Your ...
Chrome, Firefox, or Edge for Windows: Press Ctrl+F5 (If that doesn't work, try Shift+F5 or Ctrl+Shift+R). Chrome or Firefox for Mac: Press Shift ......
Read more >
What is a Hard Refresh? How to do a Hard Refresh in Any ...
A hard refresh clears your browser cache for a specific page, which forces it to load the most recent version of that page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found