Skip to content

Instantly share code, notes, and snippets.

@c01nd01r
Last active December 22, 2015 18:17
Show Gist options
  • Save c01nd01r/4aadd99ca0d2a38bcf0c to your computer and use it in GitHub Desktop.
Save c01nd01r/4aadd99ca0d2a38bcf0c to your computer and use it in GitHub Desktop.
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