Gulp validate javascript before go live

With gulp we can validate our javascript files before it crashes. follow these steps to validate javascripts files using gulp-jsValidate.
first thing we need to install gulp, gulp-cli and gulp-jsValidate with gulp-debug.
then

var gulp = require('gulp'),
    jsValidate = require('gulp-jsvalidate'),
    debug = require('gulp-debug');

gulp.task('default', function () {
    return gulp.src('app.js')
        .pipe(debug())
        .pipe(jsValidate());
});

here we can pass a single file path or array of files in gulp.src.
for validating file on the fly we must implement it by gulp-watch.

Leave a Reply

Your email address will not be published. Required fields are marked *