gulp-tinypng
Image optimization with Gulp and TinyPNG
npm i -g gulp-tinypng
var gulp = require('gulp'),
tiny = require('gulp-tiny'),
paths = {
input: 'img/**/*.{png,jpg,jpeg,JPG,PNG,JPEG}',
output: 'TinyImg'
};
var Api_Key = [
'8FiQFj9oWwEyTBHMMwxjvuYNx05Fphk2'
];
gulp.task('tiny', function () {
return gulp.src(paths.input, {since: gulp.lastRun('tiny')})
.pipe(tiny({
apiKey : Api_Key,
cache: false,
log: false
}))
.pipe(gulp.dest(paths.output))
});
gulp.task('default', gulp.series('tiny'));api_Keys = [
'API_KEY'
]
cached: false
log: false
- add the possibility to Resize Images
- scale
- fit
- cover
- rename images with the prefix like that
- tinyimage-320.jpg
- tinyimage-480.jpg
- tinyimage-640.jpg
MIT © EinfachAleks
Original MIT © Gaurav Jassal