this is my use case:
I have a source folder with icon 'collections' divided in folders, i.e.
src/
svg/
basic/
icon-1.svg
icon-2.svg
...
ecommerce/
icon-1.svg
icon-2.svg
...
social/
icon-1.svg
icon-2.svg
...
...
Now, I'd like to export all these icons to SVG spritesheets with gulp-svg-sprite into this structure:
dest/
svg/
icons-basic.svg
icons-ecommerce.svg
icons-social.svg
...
Now, I already know how to output a SVG spritesheet with all icons, but I cannot figure out how to pass the folder parameter (icons-{folder}.svg
) to gulp-svg-sprite.
This is my current gulp task:
gulp.task( 'build:svg', () => {
return gulp.src( path.join( 'src', 'svg', '**/*.svg' ) )
.pipe( svgmin( { js2svg: { pretty: true } } ) )
.pipe( svgsprite({
mode: {
symbol: {
dest: '.',
sprite: 'icons.svg'
}
}
}))
.pipe( gulp.dest( path.join( 'public', 'assets', 'svg' ) ) );
});
Anyone knows some way to do this?