Skip to content

PlethoraThemes/gulp-crash-wav-sound

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-crash-wav-sound

Play a WAV file when gulp crashes.

Errors in gulp tasks tend to crash it. You then spend a few minutes trying to figure out what's gone wrong only to find that gulp crashed and you didn't notice.

Use this plugin to play a sound when gulp crashes so you know you need to fix something.

This plugin can also be used with gulp-plumber.

This plugin is a trimmed down version of gulp-crash-sound by Zac Barton that does not use lame and MP3.

Installation

$ npm install -g gulp-crash-wav-sound

Examples

The following examples show you 3 ways to use gulp-crash-wav-sound.

1. Just include and use defaults.

var gCrashSound = require('gulp-crash-wav-sound');

gulp.task('build', function() {
	gulp.src('/some/path');
});
// if gulp crashes (for any task) a sound will be played

2. Play a sound in your error handler.

var gCrashSound = require('gulp-crash-wav-sound');

function yourOnErrorFunction(err) {
	gCrashSound.play();
	// handle error
}

// somewhere in gupfile.js
.on('error', yourOnErrorFunction)

3. Wrap gulp-plumber.

var gCrashSound = require('gulp-crash-wav-sound');

// somewhere in gupfile.js
.pipe(plumber({
  errorHandler: gCrashSound.plumb(yourOnErrorFunction)
  // if gulp crashes a sound is played before calling your error function
}))

Configuration

The default sound is a 'gulp' but you can use any WAV (drm free).

var gCrashSound = require('gulp-crash-wav-sound');

gCrashSound.config({
	file: '/path/to/your/wav/'
	, duration: 3 // 3 seconds. can be null (or not set) to play full length which is the default
});

Requirements

  • Linux: aplay
  • OSX: afplay

Known Issues

  • No Windows support

About

Play a WAV when gulp crashes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%