How to write a glob in javascript to exclude and include the files? -


i wrote following line of code contains glob exclude files every folder:

 var images = gulp.src(['src/**/*.{png,svg,jpg,gif}', '!src/styles/images/abc/*.svg',     '!src/styles/images/pqr/*card*.svg', '!src/styles/images/def/*.svg', '!src/styles/images/xyz/*.svg',     '!src/styles/images/*-16.svg', '!src/styles/images/*[!16].svg', '!src/styles/images/svg-16/*.svg',      '!src/styles/images/uvw/*.png']).pipe(gulp.dest('build')); 

as can see repeating src/styles/images everywhere. how can further simplify glob? there other ways possible can make repeated path common , add rest?

any , suggestions appreciated.

thank you.

using mapping idea problem

var src = ['src/**/*.{png,svg,jpg,gif}'] var stylesimages = [ 'abc/*.svg', 'pqr/*card*.svg', 'table/*.svg', 'xyz/*.svg', '*-16.svg', '*[!16].svg', 'svg-16/*.svg',      'uvw/*.png'].map(x => '!src/styles/images/' + x)  src = src.concat(stylesimages)  var images = gulp.src(src).pipe(gulp.dest('build')); 

Comments