Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
browserSync seems to reload even though I tell it to stream

Consider the following code:

function styleIt(){
    let dir = "./SomeDir/"+curProject+"/assets/";

    return gulp.src( dir+"scss/**/*.scss" )
    .pipe( sass().on('error', sass.logError))
    .pipe( sass({ 
            errLogToConsole: true
        })
    ).on('error', function(e){console.log(e)} )

    // auto prefixer
    .pipe( autoprefixer({ browsers: ['last 2 versions', 'ie >= 11', 'android >= 4.4', 'ios >= 7'] }) )
    .pipe( gulp.dest( dir+'css/' ) ).on( 'error', function(e){ log(e) } )

    // stream changes to all browsers .stream()
    .pipe( browserSync.stream() );
}
function watchIt(){
    let dir = "SomeDir/"+curProject+'/assets/';

    browserSync.init({
        plugins: ['bs-console-qrcode'],
        open: false,
        proxy: curProjectUrl,
    
        files: [ dir+'/**' ],
        serveStatic: [ dir+"/" ],
        rewriteRules: [
            {
                match: new RegExp('SomeDir/inject.css'),
                fn: function() {
                    return '/css/'+curProject+'.css';
                }
            }
        ],
        snippetOptions: {
            rule: {
                match: /<\/body>/i,
                fn: function (snippet, match) {
                    return '<script type="text/javascript" src="/js/'+curProject+'.js"></script>' + snippet + match;
                }
            }
        }
    });

    const watcher = gulp.watch( "./SomeDir/"+curProject+"/assets/**/*.scss", styleIt);

    watcher.on('change', function( path, stats) {
        console.log(`File ${path} was changed `+stats);
    });
}
exports.watchIt = watchIt;

As you can see there's not a single mention of the .reload but I do .stream.. still browserSync seems intend on refreshing the page instead of streaming the change. And I can for the life of me not figure out why it ignores the stream and reloads instead. Can anyone see what I have missed?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda