N
N
Nikolai2018-03-24 17:00:15
gulp.js
Nikolai, 2018-03-24 17:00:15

gulp + browser sync. Why is stream not working?

In general, it keeps track and updates, but if you write ({ stream: true }), then it stops watching style files. What could be the problem?

var 	gulp          = require('gulp'),
    browsersync   = require('browser-sync'),
    rsync         = require('gulp-rsync');



gulp.task('rsync', function() {
  return gulp.src('app/**')
  .pipe(rsync({
    root: 'app/',
    hostname: '[email protected]',
    destination: 'yousite/public_html/',
    // include: ['*.htaccess'], // Includes files to deploy
    exclude: ['**/Thumbs.db', '**/*.DS_Store'], // Excludes files from deploy
    recursive: true,
    archive: true,
    silent: false,
    compress: true
  }))
});


gulp.task('watch', ['browser-sync'], function() {
  gulp.watch('catalog/view/theme/moneymaker2/stylesheet/*.css', browserSync.reload({ stream: true }));
  gulp.watch('catalog/view/theme/moneymaker2/template/**/*.tpl', browserSync.reload);
});

gulp.task('browser-sync', function() {
  browsersync.init({
    proxy: "podgoroy.loc",
    notify: false
  });
});

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

[16:56:54] Using gulpfile C:\OSPanel\domains\podgoroy.loc\gulpfile.js
[16:56:54] Starting 'browser-sync'...
[16:56:55] Finished 'browser- sync' after 181 ms
[16:56:55] Starting 'watch'...
[16:56:55] 'watch' errored after 264 µs
[16:56:55] ReferenceError: browserSync is not defined
at Gulp. (C:\OSPanel\domains\podgoroy.loc\gulpfile.js:25:64)
at module.exports (C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\OSPanel\domains\podgoroy.loc\node_modules\ orchestrator\index.js:214:10)
at C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\index.js:279:18
at finish (C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\lib\runTask.js:21:8 )
at module.exports (C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\lib\runTask.js:60:3)
at Gulp.Orchestrator._runTask (C:\OSPanel\domains\podgoroy.loc\node_modules \orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\OSPanel\domains\podgoroy.loc\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C: \OSPanel\domains\podgoroy.loc\node_modules\orchestrator\index.js:134:8)
[Browsersync] Proxying: podgoroy.loc
[Browsersync] Access URLs:
------ ---------------------
Local: localhost:3000
External: 172.20.10.4:3000
------------------------------------
UI: localhost:3001
UI External: 172.20.10.4:3001

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
frammmm, 2018-03-24
@nikolay_akhmetyanov

browsersync = require('browser-sync'),
=> And change in the task

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question