Created
June 26, 2014 02:21
-
-
Save ayapi/4e8f806209d2d073cad3 to your computer and use it in GitHub Desktop.
gulp-svg2png + gulp-newer + gulp-imagemin + pngquant
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
var gulp = require('gulp'); | |
var newer = require('gulp-newer'); | |
var svg2png = require('gulp-svg2png'); | |
var imagemin = require('gulp-imagemin'); | |
var pngquant = require('imagemin-pngquant'); | |
var path = { | |
svg2png : { | |
src : 'svg/*.svg', | |
dest : 'img' | |
} | |
}; | |
gulp.task('svg2png', function () { | |
return gulp.src(path.svg2png.src) | |
.pipe(newer({ | |
dest: path.svg2png.dest, | |
ext: '.png' //←これをゎすれると全svgファイルを変換しちゃぅから注意 | |
})) | |
.pipe(svg2png()) | |
.pipe(imagemin({ | |
use: [pngquant()] | |
})) | |
.pipe(gulp.dest(path.svg2png.dest)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment