From 9db41cf4bef5c7ee06471660f82f4ec8e2b7028e Mon Sep 17 00:00:00 2001 From: kayone Date: Fri, 29 Aug 2014 22:59:08 -0700 Subject: [PATCH] added imageMin task --- gulp/gulpFile.js | 1 + gulp/imageMin.js | 16 ++++++++++++++++ gulp/less.js | 2 ++ gulp/paths.js | 1 + package.json | 22 +++++++++++----------- 5 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 gulp/imageMin.js diff --git a/gulp/gulpFile.js b/gulp/gulpFile.js index 05279f7ca..bc2392266 100644 --- a/gulp/gulpFile.js +++ b/gulp/gulpFile.js @@ -7,5 +7,6 @@ require('./handlebars.js'); require('./copy.js'); require('./less.js'); require('./stripBom.js'); +require('./imageMin.js'); diff --git a/gulp/imageMin.js b/gulp/imageMin.js new file mode 100644 index 000000000..1dec8fa00 --- /dev/null +++ b/gulp/imageMin.js @@ -0,0 +1,16 @@ +var gulp = require('gulp'); +var print = require('gulp-print'); +var paths = require('./paths.js'); + + +gulp.task('imageMin', function () { + var imagemin = require('gulp-imagemin'); + return gulp.src(paths.src.images) + .pipe(imagemin({ + progressive: false, + optimizationLevel :4, + svgoPlugins: [{removeViewBox: false}] + })) + .pipe(print()) + .pipe(gulp.dest(paths.src.images)); +}); \ No newline at end of file diff --git a/gulp/less.js b/gulp/less.js index b6088008a..72587332f 100644 --- a/gulp/less.js +++ b/gulp/less.js @@ -3,6 +3,7 @@ var less = require('gulp-less'); var print = require('gulp-print'); var paths = require('./paths'); +var errorHandler = require('./errorHandler'); gulp.task('less', function () { return gulp.src([ @@ -26,5 +27,6 @@ gulp.task('less', function () { ieCompat: true, strictImports: true })) + .on('error', errorHandler.onError) .pipe(gulp.dest(paths.dest.content)); }); \ No newline at end of file diff --git a/gulp/paths.js b/gulp/paths.js index 4c65dd1f6..48858935c 100644 --- a/gulp/paths.js +++ b/gulp/paths.js @@ -7,6 +7,7 @@ module.exports = { scripts: './src/UI/**/*.js', less: ['./src/UI/**/*.less'], content: './src/UI/Content/', + images: './src/UI/Content/Images/**/*', exclude :{ libs:'!./src/UI/JsLibraries/**' } diff --git a/package.json b/package.json index 150d04b90..24c11f58a 100644 --- a/package.json +++ b/package.json @@ -15,22 +15,22 @@ "gitHead": "9ff7aa1bf7fe38c4c5bdb92f56c8ad556916ed67", "readmeFilename": "readme.md", "dependencies": { + "fs-extra": "^0.11.0", "gulp": "^3.8.7", - "gulp-handlebars": "^2.2.0", - "gulp-declare": "^0.3.0", + "gulp-cached": "^1.0.1", "gulp-clean": "^0.3.1", "gulp-concat": "^2.3.4", - "gulp-wrap-amd": "^0.3.1", - "gulp-wrap": "^0.3.0", - "streamqueue": "^0.1.1", - "gulp-replace": "^0.4.0", - "fs-extra": "^0.11.0", - "gulp-print": "^1.1.0", - "gulp-less": "^1.3.5", + "gulp-declare": "^0.3.0", + "gulp-handlebars": "^2.2.0", "gulp-jshint": "^1.8.4", - "gulp-cached": "^1.0.1", + "gulp-less": "^1.3.5", + "gulp-print": "^1.1.0", + "gulp-replace": "^0.4.0", + "gulp-wrap": "^0.3.0", + "gulp-wrap-amd": "^0.3.1", "jshint-stylish": "^0.4.0", "requirejs": "^2.1.14", - "run-sequence": "^0.3.6" + "run-sequence": "^0.3.6", + "streamqueue": "^0.1.1" } }