I have a gulp task. If a file is missing (foobar.json) I want it to throw a custom error message.
Example:
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var notify = require("gulp-notify");
var foobar = './foobar.json';
gulp.task('my-task'), function() {
if (typeof foobar === 'undefined') {
console.log('foobar.json file is required to run my-task. Blau Blau Blau.');
}
else {
something.init();
}
});
Of course, console.log does not work. How do I do this?
Please don't mark as duplicate. There is no question that specifically deals with this simple issue of checking for a file, and throwing a simple message. All of the questions that I could find required a lot more complexity than this simple issue.