Search code examples
javascriptgulpresponsefeedbackbeep

gulp - Beep when done


I want to make voice control/feedback/response for my build in gulp. I wrote something like this below, but it is not working. Does anybody know how to fix it? :)

It throws this error.

// Compile Sass, autoprefix properties, generate CSS.
gulp.task('sass', function () {
  return sass('src/sass/style.scss', {style: 'compressed'})
    .pipe(autoprefixer())
    .pipe(rename('style.css'))
    .pipe(gulp.dest('src/css/'))
    .pipe(gutil.beep()) // beep when build is done
})

Solution

  • As @lsowen pointed out, gulp-util does not have the beep function anymore, so you should

    npm install --save-dev beepbeep
    

    And do something like:

    var beep = require('beepbeep');
    
    gulp.task('sass', function () {
      return sass('src/sass/style.scss', { style: 'compressed' })
        .pipe(autoprefixer())
        .pipe(rename('style.css'))
        .pipe(gulp.dest('src/css/'))
          .on('end', function () { beep(); });
    });