Answer the question
In order to leave comments, you need to log in
How to optimize images with gulp-tinypng on the server?
Hello. I installed the gulp-tinypng
plugin
on my server ( ubuntu 16.04 ) , but I don't understand how it works. There is no detailed instruction on google as I suspect it is very simple in terms of programming.
var gulp = require('gulp');
var imagemin = require('gulp-tinypng');
gulp.task('tinypng', function () {
gulp.src('src/image.png')
.pipe(tingpng('API_KEY'))
.pipe(gulp.dest('dist'));
});
nano /node_modules/gulp-tinypng/jim.js
var gulp = require('gulp');
var imagemin = require('gulp-tinypng');
gulp.task('tinypng', function () {
gulp.src('/var/www/*.png')
gulp.src('/var/www/*.jpg')
.pipe(tingpng('мой_ключ'))
.pipe(gulp.dest(''));
});
Answer the question
In order to leave comments, you need to log in
It doesn't work because you connect the plugin as:
but you use it as tingpng
This will work
var tingpng= require('gulp-tinypng');
gulp.task('tinypng', function () {
gulp.src('/var/www/*.png')
gulp.src('/var/www/*.jpg')
.pipe(tingpng('мой_ключ'))
.pipe(gulp.dest(''));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question