Skip to content

Instantly share code, notes, and snippets.

@david-j-davis
Last active April 17, 2017 22:25
Show Gist options
  • Save david-j-davis/7280e839ecd596c822af9fcb81eb8c51 to your computer and use it in GitHub Desktop.
Save david-j-davis/7280e839ecd596c822af9fcb81eb8c51 to your computer and use it in GitHub Desktop.
Creates an svg spritesheet from svgs located in a project folder using gulp-svg-sprite module
var svgSprite = require('gulp-svg-sprite');
gulp.task('svg-sprite', function () {
console.log('Creating svg sprite...');
// Basic configuration example
var config = {
mode: {
css: {
dest: '.',
sprite: './img/sprite.svg',
render: {
scss: {
dest: './_sprite-svg.scss'
}
},
}
}
};
return gulp.src('**/*.svg', {cwd: './path/to/images/'})
.pipe(svgSprite(config))
.pipe(gulp.dest('./path/to/output'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment