gulp-check-warning
v0.0.4
Published
Check code by some patterns and warn users when some strings are matched.
Downloads
6
Readme
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