shakyShane / gulp-svg-sprites

Create SVG sprites or compile to <symbols>
MIT License
334 stars 45 forks source link

Symbols mode *and* custom filename? #41

Closed growdigital closed 10 years ago

growdigital commented 10 years ago

I don't seem to be able to get symbols mode and a custom filename:

gulp.task('sprite', function () {
  return gulp.src(paths.icons)
    .pipe(svgSprite({
      preview: false,
      mode: "symbols",
      svg: {
        sprite: "sprite.svg"
      }
    }))
    .pipe(gulp.dest("tmp/sprites"))
});

This outputs tmp/sprites/svg/symbols.svg.

If I comment out symbols mode, I get tmp/sprites/sprite.svg

No big shakes, just wondering if this is supposed to happen?

shakyShane commented 10 years ago

When using 'symbols', you need to provide that as a key to the svg option as seen here

https://github.com/shakyShane/gulp-svg-sprites/blob/master/index.js#L119-L132

Which would make your example look like:

gulp.task('sprite', function () {
  return gulp.src(paths.icons)
    .pipe(svgSprite({
      preview: false,
      mode: "symbols",
      svg: {
        symbols: "symbols.svg"
      }
    }))
    .pipe(gulp.dest("tmp/sprites"))
});
growdigital commented 10 years ago

Gotcha, thanks :)