diff --git a/config/assets/default.js b/config/assets/default.js index c64fdb7ab8..8e18df1549 100644 --- a/config/assets/default.js +++ b/config/assets/default.js @@ -35,6 +35,12 @@ module.exports = { 'modules/*/client/*.js', 'modules/*/client/**/*.js' ], + img: [ + 'modules/**/*/img/**/*.jpg', + 'modules/**/*/img/**/*.png', + 'modules/**/*/img/**/*.gif', + 'modules/**/*/img/**/*.svg' + ], views: ['modules/*/client/views/**/*.html'], templates: ['build/templates.js'] }, diff --git a/gulpfile.js b/gulpfile.js index f7b7fa4c53..d4e47ba226 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,6 +15,7 @@ var _ = require('lodash'), 'gulp-angular-templatecache': 'templateCache' } }), + pngquant = require('imagemin-pngquant'), path = require('path'), endOfLine = require('os').EOL, argv = require('yargs').argv, @@ -190,6 +191,17 @@ gulp.task('less', function () { .pipe(gulp.dest('./modules/')); }); +// Imagemin task +gulp.task('imagemin', function () { + return gulp.src(defaultAssets.client.img) + .pipe(plugins.imagemin({ + progressive: true, + svgoPlugins: [{removeViewBox: false}], + use: [pngquant()] + })) + .pipe(gulp.dest('public/dist/img')); +}); + // Angular template cache task gulp.task('templatecache', function () { var re = new RegExp('\\' + path.sep + 'client\\' + path.sep, 'g'); diff --git a/package.json b/package.json index e922f2eff3..b8a01ded1e 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "gulp-csslint": "~0.1.5", "gulp-cssmin": "~0.1.7", "gulp-eslint": "~1.0.0", + "gulp-imagemin": "~2.4.0", "gulp-jshint": "^1.11.2", "gulp-less": "^3.0.3", "gulp-livereload": "^3.8.0", @@ -104,6 +105,7 @@ "gulp-sass": "^2.0.3", "gulp-uglify": "^1.2.0", "gulp-util": "^3.0.6", + "imagemin-pngquant": "~4.2.0", "istanbul": "~0.4.1", "karma": "~0.13.15", "karma-chrome-launcher": "~0.2.0",