Update client dependencies, embed only gzipped assets and unzip on the fly if needed
This commit is contained in:
parent
c4ac9f782c
commit
5a535cf53e
6 changed files with 127 additions and 337 deletions
|
@ -24,13 +24,13 @@ if (argv.production) {
|
|||
}
|
||||
|
||||
gulp.task('html', function() {
|
||||
gulp.src('src/*.html')
|
||||
return gulp.src('src/*.html')
|
||||
.pipe(minifyHTML())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('css', function() {
|
||||
gulp.src(['src/css/fontello.css', 'src/css/style.css'])
|
||||
return gulp.src(['src/css/fontello.css', 'src/css/style.css'])
|
||||
.pipe(concat('bundle.css'))
|
||||
.pipe(autoprefixer())
|
||||
.pipe(minifyCSS())
|
||||
|
@ -75,34 +75,30 @@ function js(watch) {
|
|||
}
|
||||
|
||||
gulp.task('fonts', function() {
|
||||
gulp.src('src/font/*')
|
||||
return gulp.src('src/font/*')
|
||||
.pipe(gulp.dest('dist/font'));
|
||||
});
|
||||
|
||||
gulp.task('gzip', ['html', 'css', 'js', 'fonts'], function() {
|
||||
gulp.src('dist/**/!(*.gz)')
|
||||
return gulp.src('dist/**/!(*.gz)')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('dist'));
|
||||
.pipe(gulp.dest('dist/gz'));
|
||||
});
|
||||
|
||||
function bindata(cb) {
|
||||
if (argv.production) {
|
||||
exec('go-bindata -nomemcopy -pkg server -o ../server/bindata.go dist/...', function(err) {
|
||||
cb(err);
|
||||
});
|
||||
exec('go-bindata -nomemcopy -nocompress -pkg server -o ../server/bindata.go dist/gz/...', cb);
|
||||
} else {
|
||||
exec('go-bindata -debug -pkg server -o ../server/bindata.go dist/...', function(err) {
|
||||
cb(err);
|
||||
});
|
||||
exec('go-bindata -debug -pkg server -o ../server/bindata.go dist/...', cb);
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('bindata', ['html', 'css', 'js', 'fonts', 'gzip'], function(cb) {
|
||||
gulp.task('bindata', ['gzip'], function(cb) {
|
||||
bindata(cb);
|
||||
});
|
||||
|
||||
gulp.task('gzip:watch', function() {
|
||||
gulp.src('dist/**/*.{html,css,js}')
|
||||
return gulp.src('dist/**/*.{html,css,js}')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
|
|
@ -9,23 +9,25 @@
|
|||
"vinyl-source-stream": "~1.0.0",
|
||||
"gulp-if": "~1.2.5",
|
||||
"gulp": "~3.8.10",
|
||||
"gulp-uglify": "~1.0.2",
|
||||
"gulp-minify-css": "~0.3.11",
|
||||
"gulp-uglify": "1.2.0",
|
||||
"gulp-minify-css": "1.1.1",
|
||||
"gulp-streamify": "0.0.5",
|
||||
"gulp-minify-html": "~0.1.8",
|
||||
"watchify": "~2.2.1",
|
||||
"browserify": "~8.0.3",
|
||||
"gulp-autoprefixer": "~2.0.0",
|
||||
"gulp-minify-html": "1.0.2",
|
||||
"watchify": "3.2.1",
|
||||
"browserify": "10.2.0",
|
||||
"gulp-autoprefixer": "2.2.0",
|
||||
"gulp-gzip": "0.0.8",
|
||||
"babelify": "~5.0.3",
|
||||
"gulp-concat": "~2.5.2"
|
||||
"babelify": "6.1.0",
|
||||
"gulp-concat": "~2.5.2",
|
||||
"reactify": "^1.1.1",
|
||||
"del": "^1.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "3.2.0",
|
||||
"reflux": "0.2.5",
|
||||
"react-router": "0.12.0",
|
||||
"react": "0.12.2",
|
||||
"react-infinite": "0.2.3",
|
||||
"lodash": "3.8.0",
|
||||
"reflux": "0.2.7",
|
||||
"react-router": "0.13.3",
|
||||
"react": "0.13.3",
|
||||
"react-infinite": "0.3.4",
|
||||
"autolinker": "khlieng/Autolinker.js"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ var EventEmitter = require('events').EventEmitter;
|
|||
|
||||
class Socket extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.ws = new WebSocket('ws://' + window.location.host + '/ws');
|
||||
|
||||
this.ws.onopen = () => this.emit('connect');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue