Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 1

Gulp 4 customize source of function

Hello,


Using the package gulp-svgstore, I have this function that works well:

function svgSpriteAll() {
  return gulp
  .src('./src/assets/icons/**/*.svg')
  .pipe(svg())
  .pipe(gulp.dest('./build/assets/image'))
}

It combines all my svg into one sprite.

Now I have tons of icons and I'd like to be able to create a sprite with only the files needed (they are separated by folders).
Is it possible to create a function where I can customize the path? Something like:

function svgSpriteCustom(mySources) {
  return gulp
  .src($mySources)
  .pipe(svg())
  .pipe(gulp.dest('./build/assets/images'))
}

and call it like:

gulp svgSpriteCustom filled-actions filled-content social-networks

where filled-actions, filled-content and social-networks are actually variables to specific folders path?

Would it be better to use the package svg-sprite?

Thanks for your help!

M.