http://robertdunaway.github.io
Gulp code kata list
All code katas lists
005 Gulp - error handling
Duration
5 minutes
Brief
Implement gulp-plumber for outputting errors in a readable format.
For more information
BING/GOOGLE: “Gulp error handling”
Book:
Gulp - Quick guide to getting up and running today
Instructions
Get tutorial folder or the entire katas-Gulp repo.
Open the [before/*.sln]
file and execute the kata.
Feel free to execute this kata multiple times because repetition creates motor memory.
Github
- Before (start kata with this)
- After
Kata
In this kata we will add plumber by piping it into a task.
First we need to install the gulp-plumber plugin.
Npm install gulp-plumber --save-dev
Now add a reference to the gulp plugin.
, plumber = require('gulp-plumber')
Add plumber to a task.
gulp.task('copy-to-wwwroot', function () {
return gulp.src(['src/**/*'])
.pipe(plumber({
errorHandler: onError
}))
.pipe(gulp.dest('wwwroot'));
});
Putting it all together you will end up with something like this.
Next
Take a few minutes and imagine more examples.
0 comments:
Post a Comment