Skip to content

Commit

Permalink
Build过程图片处理添加 gulp-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
amio committed May 23, 2014
1 parent 696ba30 commit ee4363d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
16 changes: 9 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var gulp = require('gulp');
var $ = require('gulp-load-plugins')();

var LOCAL_PORT = 9999;
var SOURCE_ROOT = __dirname + '/app';
var BUILD_ROOT = __dirname + '/dist';
var SOURCE_ROOT = './app';
var BUILD_ROOT = './dist';

/**
* =====================================
Expand Down Expand Up @@ -115,9 +115,13 @@ gulp.task('html2js', function () {
});

gulp.task('imagemin', function () {
gulp.src(SOURCE_ROOT + '/images/*.*')
var imgSrc = './app/images/*.*';
var imgDst = './dist/images';

gulp.src(imgSrc)
.pipe($.changed('./dist/images'))
.pipe($.imagemin())
.pipe(gulp.dest(BUILD_ROOT + '/images/'));
.pipe(gulp.dest(imgDst));
});

gulp.task('copy', function () {
Expand All @@ -135,9 +139,7 @@ gulp.task('clean', function () {
.pipe($.clean());
});

gulp.task('build', ['clean'], function () {
gulp.start('usemin', 'imagemin', 'copy');
});
gulp.task('build', ['usemin', 'imagemin', 'copy']);

/**
* =====================================
Expand Down
37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@
},
"dependencies": {},
"devDependencies": {
"connect-livereload": "*",
"express": "^4.0.0-rc3",
"gulp": "^3.5.6",
"gulp-autoprefixer": "~0.0.6",
"gulp-cache": "~0.1.1",
"gulp-changed": "^0.3.0",
"gulp-clean": "~0.2.4",
"gulp-concat": "^2.1.7",
"gulp-connect": "~1.0.7",
"gulp-exec": "~1.0.4",
"gulp-imagemin": "~0.1.5",
"gulp-jshint": "^1.5.0",
"gulp-load-plugins": "^0.3.0",
"gulp-usemin": "~0.3.1",
"gulp-ngmin": "^0.1.2",
"gulp-uglify": "~0.2.1",
"gulp-minify-css": "~0.3.0",
"gulp-minify-html": "^0.1.2",
"gulp-ng-html2js": "~0.1.6",
"gulp-ngmin": "^0.1.2",
"gulp-rev": "^0.2.1",
"gulp-util": "~2.2.9",
"gulp-connect": "~1.0.7",
"gulp-exec": "~1.0.4",
"gulp-autoprefixer": "~0.0.6",
"gulp-jshint": "^1.5.0",
"gulp-imagemin": "~0.1.5",
"gulp-clean": "~0.2.4",
"gulp-cache": "~0.1.1",
"gulp-size": "~0.1.2",
"gulp-useref": "^0.1.2",
"gulp-concat": "^2.1.7",
"gulp-ng-html2js": "~0.1.6",
"gulp-task-listing": "^0.2.2",
"express": "^4.0.0-rc3",
"connect-livereload": "*",
"tiny-lr": "*",
"gulp-uglify": "~0.2.1",
"gulp-usemin": "~0.3.1",
"gulp-useref": "^0.1.2",
"gulp-util": "~2.2.9",
"jshint-stylish": "^0.1.5",
"open": "*",
"jshint-stylish": "^0.1.5"
"tiny-lr": "*"
},
"engines": {
"node": ">=0.10.0"
Expand Down

0 comments on commit ee4363d

Please sign in to comment.