| |
|
|
|
|
var cache = require ( 'gulp-cached' ) ;
gulp . task ( 'lint' , function ( ) {
return gulp . src ( 'files/*.js' )
. pipe ( cache ( 'linting' ) )
. pipe ( jshint ( ) )
. pipe ( jshint . reporter ( ) )
} ) ;
gulp . task ( 'watch' , function ( ) {
gulp . watch ( 'files/*.js' , [ 'lint' ] ) ;
} ) ;
gulp . task ( 'default' , [ 'watch' , 'lint' ] ) ;
-
User saves files/a.js and the lint task is called -
the files do not exist in the cache yet files/a.js and files/b.js are linted
-
-
User saves files/b.js and the lint task is called -
the contents of the file changed from the previous value files/b.js is linted
-
-
User saves files/a.js and the lint task is called -
the contents of the file have not changed from the previous value -
nothing is linted
-
cache . caches = { } ;
delete cache . caches [ 'cache name yo' ] ;