From ecc2b344eae4a538dc6011ba9d2825b73a35a0ca Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 20 Jan 2017 04:43:17 +0900 Subject: [PATCH] Implements #51 --- gulpfile.ts | 20 ++++++++++++-------- package.json | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index ce23ba4ae..c3fe6ff5e 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -27,6 +27,8 @@ import * as escapeHtml from 'escape-html'; import prominence = require('prominence'); import promiseify = require('promiseify'); import * as chalk from 'chalk'; +import imagemin = require('gulp-imagemin'); +import * as rename from 'gulp-rename'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; @@ -235,14 +237,16 @@ gulp.task('copy:client', [ 'build:client:scripts', 'build:client:styles' ], () => - es.merge( - gulp.src('./resources/**/*').pipe(gulp.dest('./built/web/resources/')), - gulp.src('./src/web/resources/**/*').pipe(gulp.dest('./built/web/resources/')), - gulp.src('./src/web/app/desktop/resources/**/*').pipe(gulp.dest('./built/web/resources/desktop/')), - gulp.src('./src/web/app/mobile/resources/**/*').pipe(gulp.dest('./built/web/resources/mobile/')), - gulp.src('./src/web/app/dev/resources/**/*').pipe(gulp.dest('./built/web/resources/dev/')), - gulp.src('./src/web/app/auth/resources/**/*').pipe(gulp.dest('./built/web/resources/auth/')) - ) + gulp.src([ + './resources/**/*', + './src/web/resources/**/*', + './src/web/app/*/resources/**/*' + ]) + .pipe(imagemin()) + .pipe(rename(path => { + path.dirname = path.dirname.replace('resources', '.'); + })) + .pipe(gulp.dest('./built/web/resources/')) ); gulp.task('build:client:pug', [ diff --git a/package.json b/package.json index 22056314a..fc24f85d2 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@types/gm": "1.17.29", "@types/gulp": "3.8.32", "@types/gulp-babel": "6.1.29", + "@types/gulp-rename": "0.0.31", "@types/gulp-tslint": "3.6.30", "@types/gulp-typescript": "0.0.32", "@types/gulp-uglify": "0.0.29", @@ -94,8 +95,10 @@ "gulp": "3.9.1", "gulp-babel": "6.1.2", "gulp-cssnano": "2.1.2", + "gulp-imagemin": "3.1.1", "gulp-livescript": "3.0.1", "gulp-pug": "3.2.0", + "gulp-rename": "1.2.2", "gulp-replace": "0.5.4", "gulp-stylus": "2.6.0", "gulp-tslint": "7.0.1",