admin管理员组

文章数量:1326061

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: 'pressed'})
    .pipe(autoprefixer())
    .pipe(rename('style.css'))
    .pipe(gulp.dest('src/css/'))
    .pipe(gutil.beep()) // beep when build is 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: 'pressed'})
    .pipe(autoprefixer())
    .pipe(rename('style.css'))
    .pipe(gulp.dest('src/css/'))
    .pipe(gutil.beep()) // beep when build is done
})
Share Improve this question edited May 19, 2017 at 18:58 Preview 35.8k10 gold badges95 silver badges113 bronze badges asked Mar 27, 2015 at 12:30 tenhobitenhobi 2,0323 gold badges25 silver badges50 bronze badges 3
  • Does it work if you remove .pipe(gutil.beep())? – lsowen Commented Mar 27, 2015 at 12:33
  • The build works, but I want 'beep' after the build will done. – tenhobi Commented Mar 27, 2015 at 12:38
  • 1 What version of gulp-util do you have? According to this, beep() was removed at some point. – lsowen Commented Mar 27, 2015 at 13:10
Add a ment  | 

3 Answers 3

Reset to default 5

Or just use

console.log('\x07');

As of now, gulp-util has the beep method. So you can add this to the end of your gulp workflow >> .on('end', function () { gutil.beep(); });

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: 'pressed' })
    .pipe(autoprefixer())
    .pipe(rename('style.css'))
    .pipe(gulp.dest('src/css/'))
      .on('end', function () { beep(); });
});

本文标签: javascriptgulpBeep when doneStack Overflow