R
R
Rob1n Bobin2017-09-14 02:46:13
gulp.js
Rob1n Bobin, 2017-09-14 02:46:13

Gulp vs BrowserSync bs.reload not working, how to fix?

the task is started via a lazy function:

'use strict';

const gulp = require('gulp');
const path = require('path');

module.exports = function lazyRequireTask(taskName, config) {

  gulp.task(taskName, function(callback){
    let task = require(path.resolve(`${config.taskPath}/${taskName}`)).call(this, config, taskName);

    return task(callback);
  });

};

task:
'use strict';

const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
const bs = require('browser-sync').create();

module.exports = function(config) {

  return () => {

    return gulp.src(`${config.pugPath}/pages/*.pug`)
      .pipe($.pug({pretty: true}))
      .pipe(gulp.dest(config.outPath))
      .on('end', bs.reload);

  }

};

all tasks are performed according to the same structure.
Well, the bottom line is that bs.reload does not work, there is a suspicion that this is due to a lazy function, help me figure out what the problem is, thanks.

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