From f70f8ceae313b4f4864798e158012f2b4685aca2 Mon Sep 17 00:00:00 2001 From: lostinlight Date: Tue, 5 Jun 2018 18:44:58 +0300 Subject: [PATCH] Fix build --- themes/starter/gulpfile.js | 46 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/themes/starter/gulpfile.js b/themes/starter/gulpfile.js index f93b684..0bd382f 100644 --- a/themes/starter/gulpfile.js +++ b/themes/starter/gulpfile.js @@ -7,8 +7,6 @@ del = require('../../node_modules/del'), eslint = require('../../node_modules/gulp-eslint'), gulp = require('../../node_modules/gulp'), - imagemin = require('../../node_modules/gulp-imagemin'), - jpegRecompress = require('../../node_modules/imagemin-jpeg-recompress'), notify = require('../../node_modules/gulp-notify'), plumber = require('../../node_modules/gulp-plumber'), rename = require('../../node_modules/gulp-rename'), @@ -16,6 +14,7 @@ sass = require('../../node_modules/gulp-sass'), sourcemaps = require('../../node_modules/gulp-sourcemaps'), stylelint = require('../../node_modules/gulp-stylelint'), + tinypng = require('../../node_modules/gulp-tinypng-extended'), uglify = require('../../node_modules/gulp-uglify'); function customPlumber (errTitle) { @@ -104,21 +103,32 @@ }); // Images - gulp.task('images', function() { - return gulp.src('../../source/img/**/*') - .pipe(imagemin([ - imagemin.gifsicle(), - jpegRecompress({ - loops: 4, - min: 50, - max: 95, - quality:'high' - }), - imagemin.optipng(), - imagemin.svgo() - ])) - .pipe(gulp.dest('../../source/img')) - }); + // gulp.task('images', function() { + // return gulp.src('../../source/img/**/*') + // .pipe(imagemin([ + // imagemin.gifsicle(), + // jpegRecompress({ + // loops: 4, + // min: 50, + // max: 95, + // quality:'high' + // }), + // imagemin.optipng(), + // imagemin.svgo() + // ])) + // .pipe(gulp.dest('../../source/img')) + // }); + + gulp.task('tinypng', function () { + return gulp.src('../../source/img/**/*.{png,jpg,jpeg}') + .pipe(plumber()) + .pipe(tinypng({ + key: 'API_KEY', + sigFile: 'images/.tinypng-sigs', + log: true + })) + .pipe(gulp.dest('../../source/img')); +}); // Watch gulp.task('watch', function() { @@ -133,5 +143,5 @@ // Production Mode gulp.task('build', function (done) { - runSequence('clean', 'styles:build', 'scripts:build', 'vendor', 'images', done); + runSequence('clean', 'styles:build', 'scripts:build', 'vendor', done); });