From bb729a5c8ebea2f8ede029caa0262972a171c48b Mon Sep 17 00:00:00 2001 From: khlieng Date: Thu, 30 Apr 2015 00:45:02 +0200 Subject: [PATCH] Make gulp run go-bindata --- README.md | 1 - bindata.go | 32 ++++++++++++++++---------------- client/gulpfile.js | 26 ++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 8362695d..f725395b 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ cd $GOPATH/src/github.com/khlieng/name_pending/client npm install gulp -p -go-bindata -nomemcopy -o ../bindata.go dist/... # Rebuild the server :) ``` \ No newline at end of file diff --git a/bindata.go b/bindata.go index ebff4318..07662e25 100644 --- a/bindata.go +++ b/bindata.go @@ -86,7 +86,7 @@ func dist_bundle_js() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/bundle.js", size: 282901, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/bundle.js", size: 282901, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -106,7 +106,7 @@ func dist_bundle_js_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/bundle.js.gz", size: 81848, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/bundle.js.gz", size: 81848, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -126,7 +126,7 @@ func dist_css_fontello_css() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/css/fontello.css", size: 689, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/css/fontello.css", size: 689, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -146,7 +146,7 @@ func dist_css_fontello_css_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/css/fontello.css.gz", size: 329, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/css/fontello.css.gz", size: 329, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -166,7 +166,7 @@ func dist_css_style_css() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/css/style.css", size: 3166, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/css/style.css", size: 3166, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -186,7 +186,7 @@ func dist_css_style_css_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/css/style.css.gz", size: 1024, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/css/style.css.gz", size: 1024, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -206,7 +206,7 @@ func dist_font_fontello_eot() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.eot", size: 5288, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/font/fontello.eot", size: 5288, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -226,7 +226,7 @@ func dist_font_fontello_eot_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.eot.gz", size: 2704, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/font/fontello.eot.gz", size: 2704, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -246,7 +246,7 @@ func dist_font_fontello_svg() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.svg", size: 1571, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/font/fontello.svg", size: 1571, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -266,7 +266,7 @@ func dist_font_fontello_svg_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.svg.gz", size: 812, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/font/fontello.svg.gz", size: 812, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -286,7 +286,7 @@ func dist_font_fontello_ttf() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.ttf", size: 5120, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/font/fontello.ttf", size: 5120, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -306,7 +306,7 @@ func dist_font_fontello_ttf_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.ttf.gz", size: 2652, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/font/fontello.ttf.gz", size: 2652, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -326,7 +326,7 @@ func dist_font_fontello_woff() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.woff", size: 2912, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/font/fontello.woff", size: 2912, mode: os.FileMode(436), modTime: time.Unix(1430347413, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -346,7 +346,7 @@ func dist_font_fontello_woff_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/font/fontello.woff.gz", size: 2862, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/font/fontello.woff.gz", size: 2862, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -366,7 +366,7 @@ func dist_index_html() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/index.html", size: 369, mode: os.FileMode(436), modTime: time.Unix(1430343952, 0)} + info := bindata_file_info{name: "dist/index.html", size: 369, mode: os.FileMode(436), modTime: time.Unix(1430347412, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -386,7 +386,7 @@ func dist_index_html_gz() (*asset, error) { return nil, err } - info := bindata_file_info{name: "dist/index.html.gz", size: 248, mode: os.FileMode(436), modTime: time.Unix(1430343962, 0)} + info := bindata_file_info{name: "dist/index.html.gz", size: 248, mode: os.FileMode(436), modTime: time.Unix(1430347421, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/client/gulpfile.js b/client/gulpfile.js index b1ed2131..aae9970c 100644 --- a/client/gulpfile.js +++ b/client/gulpfile.js @@ -1,3 +1,5 @@ +var exec = require('child_process').exec; + var gulp = require('gulp'); var gulpif = require('gulp-if'); var minifyHTML = require('gulp-minify-html'); @@ -81,17 +83,37 @@ gulp.task('gzip', ['html', 'css', 'js', 'fonts'], function() { .pipe(gulp.dest('dist')); }); +function bindata(cb) { + if (argv.production) { + exec('go-bindata -nomemcopy -o ../bindata.go dist/...', function(err) { + cb(err); + }); + } else { + exec('go-bindata -debug -o ../bindata.go dist/...', function(err) { + cb(err); + }); + } +} + +gulp.task('bindata', ['html', 'css', 'js', 'fonts', 'gzip'], function(cb) { + bindata(cb); +}); + gulp.task('gzip:watch', function() { gulp.src('dist/**/*.{html,css,js}') .pipe(gzip()) .pipe(gulp.dest('dist')); }); +gulp.task('bindata:watch', ['gzip:watch'], function(cb) { + bindata(cb); +}); + gulp.task('watch', ['default'], function() { - gulp.watch('dist/**/*.{html,css,js}', ['gzip:watch']) + gulp.watch('dist/**/*.{html,css,js}', ['gzip:watch', 'bindata:watch']) gulp.watch('src/*.html', ['html']); gulp.watch('src/css/*.css', ['css']); return js(true); }); -gulp.task('default', ['html', 'css', 'js', 'fonts', 'gzip']); \ No newline at end of file +gulp.task('default', ['html', 'css', 'js', 'fonts', 'gzip', 'bindata']); \ No newline at end of file