Last active
November 19, 2018 11:49
-
-
Save SvenPam/5b47aa364f1931bdf8ff916e097776c1 to your computer and use it in GitHub Desktop.
SVG Sprites - Gulp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ 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