Skip to content

Instantly share code, notes, and snippets.

@SvenPam
Last active November 19, 2018 11:49
Show Gist options
  • Save SvenPam/5b47aa364f1931bdf8ff916e097776c1 to your computer and use it in GitHub Desktop.
Save SvenPam/5b47aa364f1931bdf8ff916e097776c1 to your computer and use it in GitHub Desktop.
SVG Sprites - Gulp
// $ comes from using gulp-load-plugins.
gulp.task('assets:sprites', function () {
return gulp.src(`${paths.source.images}/icon/**/*.svg`)
.pipe($.changed('./'))
.pipe($.svgSprite({
shape: {
spacing: {
padding: 2
}
},
svg: {
precision: 1
},
mode: {
css: {
example: true,
prefix: ".icon__%s",
dimensions: true,
render: {
scss: true
},
sprite: `./../../img/icons`
}
}
}))
.pipe($.imagemin())
.pipe(gulp.dest(`${paths.public.sprites}`));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment