Strip bindata path
This commit is contained in:
parent
375ed94177
commit
c7faa254c5
@ -87,9 +87,9 @@ gulp.task('gzip', ['html', 'css', 'js', 'fonts'], function() {
|
|||||||
|
|
||||||
function bindata(cb) {
|
function bindata(cb) {
|
||||||
if (argv.production) {
|
if (argv.production) {
|
||||||
exec('go-bindata -nomemcopy -nocompress -pkg server -o ../server/bindata.go dist/gz/...', cb);
|
exec('go-bindata -nomemcopy -nocompress -pkg server -o ../server/bindata.go -prefix "dist/gz" dist/gz/...', cb);
|
||||||
} else {
|
} else {
|
||||||
exec('go-bindata -debug -pkg server -o ../server/bindata.go dist/...', cb);
|
exec('go-bindata -debug -pkg server -o ../server/bindata.go -prefix "dist/gz" dist/...', cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -22,12 +22,12 @@ var (
|
|||||||
sessionLock sync.Mutex
|
sessionLock sync.Mutex
|
||||||
|
|
||||||
files = []File{
|
files = []File{
|
||||||
File{"/bundle.js", "text/javascript"},
|
File{"bundle.js", "text/javascript"},
|
||||||
File{"/bundle.css", "text/css"},
|
File{"bundle.css", "text/css"},
|
||||||
File{"/font/fontello.eot", "application/vnd.ms-fontobject"},
|
File{"font/fontello.eot", "application/vnd.ms-fontobject"},
|
||||||
File{"/font/fontello.svg", "image/svg+xml"},
|
File{"font/fontello.svg", "image/svg+xml"},
|
||||||
File{"/font/fontello.ttf", "application/x-font-ttf"},
|
File{"font/fontello.ttf", "application/x-font-ttf"},
|
||||||
File{"/font/fontello.woff", "application/font-woff"},
|
File{"font/fontello.woff", "application/font-woff"},
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrader = websocket.Upgrader{
|
upgrader = websocket.Upgrader{
|
||||||
@ -73,18 +73,18 @@ func upgradeWS(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func serveFiles(w http.ResponseWriter, r *http.Request) {
|
func serveFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path == "/" {
|
if r.URL.Path == "/" {
|
||||||
serveFile("dist/gz/index.html.gz", "text/html", w, r)
|
serveFile("index.html.gz", "text/html", w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if strings.HasSuffix(r.URL.Path, file.Path) {
|
if strings.HasSuffix(r.URL.Path, file.Path) {
|
||||||
serveFile("dist/gz"+file.Path+".gz", file.ContentType, w, r)
|
serveFile(file.Path+".gz", file.ContentType, w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
serveFile("dist/gz/index.html.gz", "text/html", w, r)
|
serveFile("index.html.gz", "text/html", w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func serveFile(path, contentType string, w http.ResponseWriter, r *http.Request) {
|
func serveFile(path, contentType string, w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user