This commit is contained in:
syuilo 2017-02-19 18:21:03 +09:00
parent e94878e6cb
commit db1aff968f
5 changed files with 82 additions and 68 deletions

View file

@ -12,7 +12,6 @@ import * as tslint from 'gulp-tslint';
import * as glob from 'glob'; import * as glob from 'glob';
import * as es from 'event-stream'; import * as es from 'event-stream';
import * as webpack from 'webpack-stream'; import * as webpack from 'webpack-stream';
import stylus = require('gulp-stylus');
import cssnano = require('gulp-cssnano'); import cssnano = require('gulp-cssnano');
import * as uglify from 'gulp-uglify'; import * as uglify from 'gulp-uglify';
import riotify = require('riotify'); import riotify = require('riotify');
@ -160,29 +159,40 @@ gulp.task('build:client:scripts', () => new Promise(async (ok) => {
// TODO: remove this block // TODO: remove this block
if (isProduction) { if (isProduction) {
stream = stream 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 // ↓ https://github.com/mishoo/UglifyJS2/issues/448
.pipe(babel({ .pipe(babel({
presets: ['es2015'] presets: ['es2015']
})) }))
.pipe(uglify({ .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(); ok();
})); }));
gulp.task('build:client:styles', () => gulp.task('build:client:styles', () =>
gulp.src('./src/web/app/init.styl') gulp.src('./src/web/app/init.css')
.pipe(stylus({
compress: true
}))
.pipe(isProduction .pipe(isProduction
? cssnano({ ? cssnano()
safe: true // 高度な圧縮は無効にする (一部デザインが不適切になる場合があるため)
})
: gutil.noop()) : gutil.noop())
.pipe(gulp.dest('./built/web/resources/')) .pipe(gulp.dest('./built/web/resources/'))
); );

View file

@ -101,7 +101,6 @@
"gulp-pug": "3.2.0", "gulp-pug": "3.2.0",
"gulp-rename": "1.2.2", "gulp-rename": "1.2.2",
"gulp-replace": "0.5.4", "gulp-replace": "0.5.4",
"gulp-stylus": "2.6.0",
"gulp-tslint": "7.1.0", "gulp-tslint": "7.1.0",
"gulp-typescript": "3.1.5", "gulp-typescript": "3.1.5",
"gulp-uglify": "2.0.1", "gulp-uglify": "2.0.1",

62
src/web/app/init.css Normal file
View file

@ -0,0 +1,62 @@
@charset 'utf-8';
html {
font-family: sans-serif;
}
body > noscript > div {
position: fixed;
z-index: 32768;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
background: #fff;
}
body > noscript > div > p {
display: block;
margin: 32px;
font-size: 2em;
color: #555;
}
#init {
position: fixed;
z-index: 16384;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
background: #fff;
cursor: wait;
}
#init > p {
display: block;
user-select: none;
margin: 32px;
font-size: 4em;
color: #555;
}
#init > p > span {
animation: init 1.4s infinite ease-in-out both;
}
#init > p > span:nth-child(1) {
animation-delay: 0s;
}
#init > p > span:nth-child(2) {
animation-delay: 0.16s;
}
#init > p > span:nth-child(3) {
animation-delay: 0.32s;
}
@keyframes init {
0%, 80%, 100% {
opacity: 1;
}
40% {
opacity: 0;
}
}

View file

@ -1,56 +0,0 @@
@charset 'utf-8'
html
font-family sans-serif
body > noscript > div
position fixed
z-index 32768
top 0
left 0
width 100%
height 100%
text-align center
background #fff
> p
display block
margin 32px
font-size 2em
color #555
#init
position fixed
z-index 16384
top 0
left 0
width 100%
height 100%
text-align center
background #fff
cursor wait
> p
display block
user-select none
margin 32px
font-size 4em
color #555
> span
animation init 1.4s infinite ease-in-out both
&:nth-child(1)
animation-delay 0s
&:nth-child(2)
animation-delay 0.16s
&:nth-child(3)
animation-delay 0.32s
@keyframes init
0%, 80%, 100%
opacity 1
40%
opacity 0

View file

@ -7,7 +7,6 @@ module.exports = (config, commit, env) => {
const pack: webpack.Configuration = { const pack: webpack.Configuration = {
entry: { entry: {
'client': './src/web/app/client/script.js',
'desktop': './src/web/app/desktop/script.js', 'desktop': './src/web/app/desktop/script.js',
'mobile': './src/web/app/mobile/script.js', 'mobile': './src/web/app/mobile/script.js',
'dev': './src/web/app/dev/script.js', 'dev': './src/web/app/dev/script.js',