ionic tutorial - Add a gulp task in Ionicframework - ionic framework - ionic 2 - ionic creator - ionic development



In the root of your ionic app, there is a gulpfile.js file. Open it in an editor and paste the following gulp task:

gulp.task('lint', function() {
    return gulp.src(['./www/js/**/*.js']) 
        .pipe(jshint('.jshintrc'))
        .pipe(jshint.reporter('jshint-stylish')) 
        .pipe(jshint.reporter('fail'))
});
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

This looks for a folder called 'js' inside the 'www' folder. If you have other folders containing JavaScript files, add those too. For example, lets also add a folder called 'views':

gulp.task('lint', function() {
    return gulp.src(['./www/js/**/*.js','./www/views/**/*.js'])
        .pipe(jshint('.jshintrc'))
        .pipe(jshint.reporter('jshint-stylish')) 
        .pipe(jshint.reporter('fail'))
});
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Explanations:

  1. /**/*.js - This syntax means to look at all the js files in the subfolders too
  2. .jshintrc - This is a configuration file that we will create in the next example.

Related Searches to Add a gulp task in Ionicframework