From 0dba058a7657ca80451e83cc3b7af97dd07805aa Mon Sep 17 00:00:00 2001 From: exane Date: Fri, 3 Jul 2015 15:32:46 +0200 Subject: [PATCH] add gulp md sprites --- gulpfile.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index a5b5095..ca16103 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -81,9 +81,9 @@ gulp.task("index", function(){ }) gulp.task('resize sm', function(done){ - if(fs.existsSync(__dirname + "/assets/cards/sm/monster/arachas1.png")) { + if(fs.existsSync(__dirname + "/assets/cards/sm/monster/arachas1.png")){ console.log("skip generating sm images"); - return done(); + return done(); } return gulp.src('./assets/original_cards/**/*.png') .pipe(gm(function(gmfile){ @@ -93,8 +93,21 @@ gulp.task('resize sm', function(done){ .pipe(gulp.dest('./assets/cards/sm/')); }); -gulp.task('resize lg', ["resize sm"], function(done){ - if(fs.existsSync(__dirname + "/assets/cards/lg/monster/arachas1.png")) { +gulp.task('resize md', function(done){ + if(fs.existsSync(__dirname + "/assets/cards/md/monster/arachas1.png")){ + console.log("skip generating md images"); + return done(); + } + return gulp.src('./assets/original_cards/**/*.png') + .pipe(gm(function(gmfile){ + return gmfile.resize(null, 284); + })) + .pipe(imagemin()) + .pipe(gulp.dest('./assets/cards/md/')); +}); + +gulp.task('resize lg', ["resize sm", "resize md"], function(done){ + if(fs.existsSync(__dirname + "/assets/cards/lg/monster/arachas1.png")){ console.log("skip generating lg images"); return done(); } @@ -107,10 +120,13 @@ gulp.task('resize lg', ["resize sm"], function(done){ }); gulp.task("sprite", ["resize lg"], function(){ - if(fs.existsSync(__dirname + "/public/build/cards-lg-monster.png")) { + if(fs.existsSync(__dirname + "/public/build/cards-lg-monster.png")){ console.log("skip sprite generating"); return; } + + + console.log("start sprite generating ..."); sprity.src({ src: "./assets/cards/**/*.png", style: "cards.css", @@ -125,11 +141,9 @@ gulp.task("sprite", ["resize lg"], function(){ margin: 0 //template: "./client/scss/_cards.hbs" }) - //.pipe(gulpif("*.png", gulp.dest("./public/build/"), gulp.dest("./client/scss/"))); + //.pipe(gulpif("*.png", gulp.dest("./public/build/"), gulp.dest("./client/scss/"))); .pipe(imagemin()) .pipe(gulp.dest("./public/build/")); - - }) -gulp.task("default", ["watch", "browserify", "sass", "unit tests", "index", "resize lg", "resize sm"]); +gulp.task("default", ["watch", "browserify", "sass", "unit tests", "index", "resize lg", "resize sm", "resize md", "sprite"]);