0

gul-svg-sprite 1.2.19

I'm having a lot of trouble with the config object that is passed to gulp-svg-sprite to determine the destination of the files created. I have read the doc section on output destination and read through this other StackOverflow board on the matter.

Here is the Gulp task:

gulp.task('build-icons',function(){
    return gulp.src(assetsDev+'icons/*.svg')
        .pipe(svgSprite({
            mode: {defs:true, dest:'.'},
        }))
        .pipe(gulp.dest('icons'));
});

This is what I'm hoping to get:

icons
---sprite.defs.svg

Instead this is what I get:

icons
---defs
------svg
---------sprite.defs.svg

I'm tried changing the value of mode.dest, or adding a "dest" setting as a sibling to "mode" but it makes no difference. Basically, no matter what I write, the file is always saved in the same location. I think my setting is just ignored. For instance if I add sprite:"mysprite.svg" to the mode settings, the file is still saved as "sprite.defs.svg" in the same location.

What could be going on?

Community
  • 1
  • 1
BeetleJuice
  • 39,516
  • 19
  • 105
  • 165

1 Answers1

0

A solution was posted at https://github.com/jkphl/svg-sprite/issues/155

Basically my mistake was that I was trying to configure destination in an object sibling to defs, instead of configuring the destination within the defs object itself. the correct configuration object for my purpose should be changed from:

mode: {defs:true, dest:'.'}

to:

mode: {defs:{dest:'.'}}

The produced file is now saved in the icons folder as I wished.

BeetleJuice
  • 39,516
  • 19
  • 105
  • 165