return function () { if (bs.has(options.bs.instance)) { bs.get(options.bs.instance).init(options.browserSync); } else { console.warn(`Browser Sync: An instance with the name '${options.bs.instance}' was not found.`); } };
return function () { let bsHasInstance = global.development && bs.has(options.bs.instance); let bsInstance, interval; if (bsHasInstance) { bsInstance = bs.get(options.bs.instance); interval = setInterval(function () { bsInstance.notify('<span style="color:red">HTML is compiles...</span>', 2000); }, 1000); } let pipeline = gulp.src(src) .pipe(data(getData)).on('error', notify) .pipe(twig({ base : [path.join(options.root.src, options.twig.src)], functions: functions, })).on('error', notify) .pipe(resolver(options.twig.resolver)) .pipe(changed({firstPass: true})) .pipe(gulp.dest(build)); if (bsHasInstance) { pipeline = pipeline.on('end', function () { clearInterval(interval); bsInstance.reload(); }); } return pipeline; };
module.exports = () => { 'use strict'; return gulp.src([ 'src/assets/**/*', 'src/default.json', ], { base: 'src' }) .pipe(gulp.dest('build')) .pipe(browserSync.has('app') ? browserSync.get('app').reload({ stream: true }) : gutil.noop()); };
proto[level] = function() { var args = _.toArray(arguments); args.unshift(this.prefix); if (this.paused) { this.paused.push({ level: level, args: args }); } else { if (bs.active && bs.has('server') && levels[level] >= levels[log.level]) { bs.get('server').notify(util.format.apply(util, arguments)); } log[level].apply(log, args); } };
module.exports = () => { 'use strict'; return gulp.src([ 'src/css/*.css' ]) .pipe(postcss([ autoprefixer() ])) .pipe(concat('style.css', { newLine: "\n" })) .pipe(gulp.dest('build/css')) .pipe(browserSync.has('app') ? browserSync.get('app').reload({ stream: true }) : gutil.noop()); };
.on('end', function () { if (bs.has(options.bs.instance)) bs.get(options.bs.instance).reload(); done(); });
'use strict'; var path = require('path'); var gulp = require('gulp'); var config = require('./config'); var bs = require('browser-sync'); var browserSync = bs.has('dev-server') ? bs.get('dev-server') : bs.create('dev-server'); var $ = require('gulp-load-plugins')({ lazy: true }); var src = [ path.join(config.paths.src, 'styles/variables/**/*.scss'), path.join(config.paths.src, 'styles/common/**/*.scss'), path.join(config.paths.src, 'components/**/*.scss') ]; var libs = [path.join(config.paths.src, '/styles/libs.scss')]; // lint - error checking gulp.task('styles:lint', function() { gulp.src(path.join(config.paths.src, '/components/**/*.scss')) .pipe($.sassLint()) .pipe($.sassLint.format()) .pipe($.sassLint.failOnError()) });
import bs from "browser-sync"; const instance = bs.has("server") ? bs.get("server") : bs.create("server"); export default instance;