browser-sync does not refresh page after changes with Gulp

gulp 4 browsersync not reloading
browser-sync cannot get
gulp browser-sync not working
browsersync inject changes
browsersync proxy not working
gulp browsersync don t open browser
browser reload
gulp-livereload

I'm new to Gulp and I wanted to make use of its automatic scss compiling and browser sync. But I can't get it to work.

I stripped everything down to leave only the contents of the example on the Browsersync website:

http://www.browsersync.io/docs/gulp/#gulp-sass-css

var gulp        = require('gulp');
var browserSync = require('browser-sync').create();
var sass        = require('gulp-sass');

// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {

    browserSync.init({
        server: "./app"
    });

    gulp.watch("app/scss/*.scss", ['sass']);
    gulp.watch("app/*.html").on('change', browserSync.reload);
});

// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
    return gulp.src("app/scss/*.scss")
        .pipe(sass())
        .pipe(gulp.dest("app/css"))
        .pipe(browserSync.stream());
});

gulp.task('default', ['serve']);

I can call gulp serve. The site is showing and I get a message from Browsersync. When I modify the HTML, the page is reloaded. When however I modify the scss, I can see this:

[BS] 1 file changed (test.css)
[15:59:13] Finished 'sass' after 18 ms

but I have to reload manually. What am I missing?


You can just inject the changes instead of having to force a full browser refresh on SASS compile if you like.

browserSync.init({
    injectChanges: true,
    server: "./app"
});

gulp.task('sass', function() {
    return gulp.src("app/scss/*.scss")
        .pipe(sass())
        .pipe(gulp.dest("app/css"))
        .pipe(browserSync.stream({match: '**/*.css'}));
});

Gulp.js browser-sync not reloading my browser · Issue #1489 , It does not load the changes though. When I ma gulp.task('pages:reset', function(cb) { Browser-sync not reloading browser after CLI update  gulp-concat will only concat the files that were specified by gulp.src within the current stream. If you've only specified app.scss, you can't concatenate additional files on that stream. That doesn't mean you can't create a new stream that contains the app.scss compiled output and includes animate.css as well.


I also faced a similar problem when I was new to browser-sync usage, the command-line was saying "reloading browsers" but the browser was not refreshed at all, the problem was I had not included body tag in my HTML page where the browser-sync can inject script for its functionality, make sure your HTML page has body tag.

Browsersync + Gulp.js, These are all the options that you can configure when using Browsersync. Changes you make will either be injected into the page (CSS & images) or will cause all browsers to do a full-page refresh. options: { ignored: '*.txt' } } ] }); // NOTE: the .watch() method will not receive // these options automatically, so you must  Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Talent Hire technical talent


This is because you're calling browserSync.reload on the html watch and not on the scss watch.

Try this:

gulp.watch("app/scss/*.scss", ['sass']).on('change', browserSync.reload);
gulp.watch("app/*.html").on('change', browserSync.reload);

Browsersync options, I'm using Gulp and Browsersync and for the life of me I couldn't get the reload to actually take place. Turns out I didn't specify properly what files Browsersync needs to trigger when changed. Here's the gulp.task() that worked for That's the ticket, right there. Once I did that, it was magic sauce all over again. Upon running gulp watch the connection gets initialised so BrowserSync is installed and working. However it doesn't seem to pick up on any changes. Here's my gulp file: var gulp = require("gulp"); var shell = require('gulp-shell'); var elixir = require('laravel-elixir'); var themeInfo = require('./theme.json'); var task = elixir.Task; elixir.extend ("stylistPublish", function() { new task ("stylistPublish", function() { return gulp.src ("").pipe (shell ("php ../../artisan stylist:publish " +


This is what I use and it work's fine in sass or any other files

gulp.task('browser-sync', function () {
   var files = [
      '*.html',
      'css/**/*.css',
      'js/**/*.js',
      'sass/**/*.scss'
   ];

   browserSync.init(files, {
      server: {
         baseDir: './'
      }
   });
});

Fixing Browsersync Not Reloading – Johnathan.org, The problem I'm having is that browser sync is not refreshing once the new different browsers and the iOS simulator and can see the scrolling and page the browser sync has injected the new main.css file but nothing changes on roots git:(deps) gulp watch [23:51:29] Using gulpfile ~/DEV/opensauce/roots/​gulpfile.js  Gulp browser-sync is not reloading my browser. When I hit save on my project it builds everything fine. My browser blinks and says "Connected to Browser-sync" on the upper right hand corner. It does not load the changes though. When I manually hit refresh, on chrome, it will load the changes.


Ran into this same problem trying to reload php and js files and stream css files. I was able to use stream only by using a pipe method, which makes sense. Anyway, here's what worked for me:

gulp.watch(['./**/*.css']).on('change', function (e) {
    return gulp.src( e.path )
        .pipe( browserSync.stream() );
});

But, I actually prefer @pixie's answer modified:

gulp.task('default', function() {
    var files = [
            './**/*'
        ];
    browserSync.init({
        files : files,
        proxy : 'localhost',
        watchOptions : {
            ignored : 'node_modules/*',
            ignoreInitial : true
        }
    });
});

Browser Sync not refreshing after injecting css - sage, Live Reloading with Browser Sync - Live Reload specifies the changes in the file system. the live reload to the page in all browsers whenever files were changed. You need to create task for BrowserSync to work with server using Gulp. You can also inject new styles into the browser by using below task for CSS file: I'm using Gulp + BrowserSync and I'm trying to reload my development website when changes are made to my HTML files, but I can't seem to get it working. I'm getting no errors in the command line, my page seems to reload but the changes I've made don't appear in the browser, unless I quit the gulp task and run it again. This is my current setup:


Live Reloading with Browser Sync, npm install browser-sync gulp-sass gulp-slang gulp-watch gulp --save-dev Make some changes and refresh that page and you should see the changes! start making edits to your code and see changes without refreshing! Browser Sync not injecting get the styles and I need to manually refresh the page to see the changes. for file changes gulp. task (' browser-sync ',


AEM: Auto-Reloading your browser on JS, HTML, and CSS changes , Gulp 4 - BrowserSync and Auto Reload Published on Jan 3, 2019 Many examples on Duration: 11:51 Posted: Jan 3, 2019 Issue details I have a markdown file that I change and convert to html using pandoc. browsersync is detecting the file change but does not refresh the browser. I am running it on Linux 4.4.0-57-generic.


Gulp 4 - BrowserSync and Auto Reload, When building Angular or Vue Unfortunately the same cannot be said for server side code. When making changes to script pages in Web  Ruby SASS & Source Maps ^ TOP. If you use gulp-ruby-sass with the sourcemap: true option, additional .map files will be generated. These files end up being sent down stream and when browserSync.reload() receives them, it will attempt a full page reload (as it will not find any .map files in the DOM).