gulp-tinify-and-convert
v1.1.0
Published
Minify PNG, JPEG, and WEBP images via TinyPNG's API
Downloads
4
Maintainers
Readme
gulp-tinify
Update of Josh Broton's gulp-tinify package
Minify compatible files using TinyPNG's API
You must have a TinyPNG Developer API Key for this to work.
The API key is meant to be a local variable named TINIFY_KEY
Usage
var gulp = require('gulp');
var tinify = require('gulp-tinify');
gulp.task('tinify', function() {
gulp.src('/img/**/*')
.pipe(tinify())
.pipe(gulp.dest('/dest/img'));
});
The conversion mode can be passed to it.
var gulp = require('gulp');
var tinify = require('gulp-tinify');
gulp.task('tinify', function() {
gulp.src('/img/**/*')
.pipe(tinify(['image/webp']))
.pipe(gulp.dest('/dest/img'));
});
This will convert and compress every image into a .webp image.
The conversion mode can also be set to 'direct' to just compress the image, maintaining filetype.
var gulp = require('gulp');
var tinify = require('gulp-tinify');
gulp.task('tinify', function() {
gulp.src('/img/**/*')
.pipe(tinify('direct'))
.pipe(gulp.dest('/dest/img'));
});