B
B
bormor2017-08-25 12:40:50
Layout
bormor, 2017-08-25 12:40:50

Browser-Sync does not save scroll on page refresh. How to fix it?

After editing, Browser-Sync does not save the scroll (it moves to the middle of the page). Insanely inconvenient when, for example, you make edits to the footer.
When updating css, the message "Injected:style.css" pops up. Those. like the whole page should not be updated.
The problem appears on large pages (when there are more than 3 "screens").
Browsersync version 2.18.13.
Googling shows that many have encountered this, but have not found a working solution.

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

gulp.task('server', function() {
  browserSync.init({
    server: {
      baseDir: 'build/',
    },
    open: false,
    online: false,

    files:[  
        'build/*.html',
        'build/css',
        'build/js',
        'build/fonts/',
        'build/img',
    ],

    ghostMode: {
        scroll: true
    },

    logLevel: 'info', // 'debug', 'info', 'silent', 'warn'
    logConnections: false,
    logPrefix: "Browser-Sync",
    port: 8080,
    notify: true
  });
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question