Last active
August 29, 2015 14:15
-
-
Save joaocunha/ecdb5e606be75faac897 to your computer and use it in GitHub Desktop.
Basic error handling capabilities for gulp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var paths = { | |
src: 'src', | |
dist: 'dist' | |
}; | |
// --------------------------------------- | |
// BASIC ERROR HANDLING | |
var gutil = require('gulp-util'); | |
var notify = require('gulp-notify'); | |
function handleError(err) { | |
notify.onError({ | |
title: "Gulp", | |
subtitle: "Failure!", | |
message: "Error: <%= error.message %>", | |
sound: "Beep" | |
})(err); | |
err = gutil.colors.red(err); | |
gutil.log(err); | |
gutil.beep(); | |
this.emit('end'); | |
} | |
// --------------------------------------- | |
// STYLUS | |
var stylus = require('gulp-stylus'); | |
var rename = require('gulp-rename'); | |
var jeet = require('jeet'); | |
var rupture = require('rupture'); | |
gulp.task('stylus', ['clean:css'], function () { | |
return gulp.src(paths.src + '/stylus/*.styl') | |
.pipe(stylus({ | |
use: [jeet(), rupture()], | |
compress: true, | |
})) | |
.on('error', handleError) | |
.pipe(rename({ | |
suffix: '.min' | |
})) | |
.pipe(gulp.dest(paths.dist + '/css')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment