From f8f90a60aed9d050d132ef9cfe72fb19ec52359b Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 19 Feb 2017 18:21:03 +0900 Subject: Clean up --- gulpfile.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'gulpfile.ts') diff --git a/gulpfile.ts b/gulpfile.ts index e70e13798b..30812bead9 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -12,7 +12,6 @@ import * as tslint from 'gulp-tslint'; import * as glob from 'glob'; import * as es from 'event-stream'; import * as webpack from 'webpack-stream'; -import stylus = require('gulp-stylus'); import cssnano = require('gulp-cssnano'); import * as uglify from 'gulp-uglify'; import riotify = require('riotify'); @@ -160,29 +159,40 @@ gulp.task('build:client:scripts', () => new Promise(async (ok) => { // TODO: remove this block if (isProduction) { stream = stream + // ↓ https://github.com/mishoo/UglifyJS2/issues/448 + .pipe(babel({ + presets: ['es2015'] + })) + .pipe(uglify()); + } + + let entryPointStream = gulp.src('./src/web/app/client/script.js'); + + if (isProduction) { + entryPointStream = entryPointStream // ↓ https://github.com/mishoo/UglifyJS2/issues/448 .pipe(babel({ presets: ['es2015'] })) .pipe(uglify({ - compress: true + mangle: { + toplevel: true + } })); } - stream.pipe(gulp.dest('./built/web/resources/')); + es.merge( + stream.pipe(gulp.dest('./built/web/resources/')), + entryPointStream.pipe(gulp.dest('./built/web/resources/client/')) + ); ok(); })); gulp.task('build:client:styles', () => - gulp.src('./src/web/app/init.styl') - .pipe(stylus({ - compress: true - })) + gulp.src('./src/web/app/init.css') .pipe(isProduction - ? cssnano({ - safe: true // 高度な圧縮は無効にする (一部デザインが不適切になる場合があるため) - }) + ? cssnano() : gutil.noop()) .pipe(gulp.dest('./built/web/resources/')) ); -- cgit v1.3.1-freya