Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulp build error to browser
//npm i gulp gulp-stylus gulp-plumber browser-sync bs-fullscreen-message
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var plumber = require('gulp-plumber');
var browserSync = require('browser-sync').create();
//Enable "Fullscreen Messages" plugin in Browsersync Plugins web settings (http://localhost:3001/plugins)
//Notification template
var bsError = function(data) {
browserSync.sockets.emit('fullscreen:message', {
title: data.plugin + ': Ахтунг! У нас ' +data.name ,
body: data.message
}
)};
//Static Server + watching styl files
gulp.task('serve', ['styl'], function() {
browserSync.init({
server: "./app",
plugins: ['bs-fullscreen-message']
});
gulp.watch("app/style/*.styl", ['styl']);
});
// Compile styl into CSS & auto-inject into browsers
gulp.task('styl', function() {
return gulp.src("app/style/*.styl")
.pipe(plumber(bsError))
.pipe(stylus())
.pipe(gulp.dest("app/css"))
.pipe(browserSync.stream());
});
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.