diff --git a/gulpfile.js b/gulpfile.js index 84744cf93..c4ef3eab4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,13 +5,13 @@ var useref = require('gulp-useref'); var del = require('del'); var babel = require('gulp-babel'); var uglify = require('gulp-uglify'); - +var imagemin = require('gulp-imagemin'); // var gutil = require('gulp-util'); -var browserSync = require('browser-sync').create(); -var webpack = require('webpack'); -var WebpackDevServer = require('webpack-dev-server'); -var webpackConfig = require('./webpack.config.js'); -var stream = require('webpack-stream'); +// var browserSync = require('browser-sync').create(); +// var webpack = require('webpack'); +// var WebpackDevServer = require('webpack-dev-server'); +// var webpackConfig = require('./webpack.config.js'); +// var stream = require('webpack-stream'); var paths = { styles: { @@ -72,9 +72,12 @@ function html() { .pipe(gulp.dest(paths.html.dest)); } -// copy /img to /dist +// compress images; copy /img to /dist function images() { return (gulp.src(paths.images.src)) + .pipe(imagemin([ + imagemin.jpegtran({ progressive: true }) + ])) .pipe(gulp.dest(paths.images.dest)); } diff --git a/package.json b/package.json index 28214ae90..e2c8ba4f2 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "gulp-babel": "^8.0.0-beta.2", "gulp-concat": "^2.6.1", "gulp-grunt": "^0.5.5", + "gulp-imagemin": "^4.1.0", "gulp-sourcemaps": "^2.6.4", "gulp-uglify": "^3.0.0", "gulp-useref": "^3.1.5",