Created
August 10, 2015 15:51
-
-
Save jgatjens/565e1c773c9c3c2e24a5 to your computer and use it in GitHub Desktop.
Gulp - SVGs sprite generator - include content into html
This file contains hidden or 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
// Combine svg files and inject it into index.html | |
gulp.task('svg', () => { | |
var svgs = gulp | |
.src('app/images/svg/*.svg') | |
.pipe($.svgmin()) | |
.pipe($.svgstore({ inlineSvg: true })); | |
function fileContents (filePath, file) { | |
return file.contents.toString(); | |
} | |
return gulp | |
.src('app/index.html') | |
.pipe($.inject(svgs, { transform: fileContents })) | |
.pipe(gulp.dest('app')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment