gulp-check-warning

0.0.4 • Public • Published

gulp-check-warning

Check code by some patterns and warn users in your terminal when some strings are matched.

Usage

Install gulp-check-warning as a development dependency:

npm i gulp-check-warning -D

Then, add it to your gulpfile.js:

var gulp = require('gulp');
var check = require('gulp-check-warning');
var checkOptions = [
    {
        pattern: 'const',
        message: 'Please don\'t use const in your code.'
    },
    {
        pattern: /(?:https?:)?\/\/[\w\-]+(?:\.[\w\-]+)*\.(?:com|org)?/i,
        message: function (matches) {
            if (/(google|google-analytics)\.com$/i.test(matches[0])) {
                return 'Please dont\'t use assets from Google.'
            }
        }
    }
];

gulp.task('check', function () {
    gulp.src(['src/**/*.*'])
        .pipe(check(checkOptions))
        .pipe(gulp.dest('./dst'))
});

API

gulp-check-warning muse be called with a Array

check(array)

Readme

Keywords

Package Sidebar

Install

npm i gulp-check-warning

Weekly Downloads

4

Version

0.0.4

License

ISC

Unpacked Size

3.86 kB

Total Files

4

Last publish

Collaborators

  • flyingsouthwind