1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-11-23 19:36:53 +00:00

add gulp md sprites

This commit is contained in:
exane 2015-07-03 15:32:46 +02:00
parent 00529ffd5c
commit 0dba058a76

View File

@ -81,7 +81,7 @@ gulp.task("index", function(){
}) })
gulp.task('resize sm', function(done){ 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"); console.log("skip generating sm images");
return done(); return done();
} }
@ -93,8 +93,21 @@ gulp.task('resize sm', function(done){
.pipe(gulp.dest('./assets/cards/sm/')); .pipe(gulp.dest('./assets/cards/sm/'));
}); });
gulp.task('resize lg', ["resize sm"], function(done){ gulp.task('resize md', function(done){
if(fs.existsSync(__dirname + "/assets/cards/lg/monster/arachas1.png")) { 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"); console.log("skip generating lg images");
return done(); return done();
} }
@ -107,10 +120,13 @@ gulp.task('resize lg', ["resize sm"], function(done){
}); });
gulp.task("sprite", ["resize lg"], function(){ 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"); console.log("skip sprite generating");
return; return;
} }
console.log("start sprite generating ...");
sprity.src({ sprity.src({
src: "./assets/cards/**/*.png", src: "./assets/cards/**/*.png",
style: "cards.css", style: "cards.css",
@ -128,8 +144,6 @@ gulp.task("sprite", ["resize lg"], function(){
//.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(imagemin())
.pipe(gulp.dest("./public/build/")); .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"]);