In the previous article, we used gulp to validate our JavaScript. The error message would appear in the console. While this is awesome, there is a chance we could miss it.
Let’s use notifications to display a pop up window when we have a JavaScript error.
There is a gulp plugin to send notifications.
1
|
|
For more information on gulp-notify
check out https://www.npmjs.org/package/gulp-notify
Remember that gulp uses node’s streaming. It shouldn’t be a surprise that when gulp-jsvalidate
finds an error, it emits an error event.
All we need to do is handle the event and use gulp-notify
to send a notification with the error message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Since our JavaScript is now valid, we need to make it invalid so we can see the error message.
1 2 3 4 |
|
Now when we run gulp javascript we will get a notification window that an error was found.
1 2 3 4 5 6 7 |
|