1
0
forked from MTSR/mapserver
mapserver/server/bundle/bundle.go

34 lines
638 B
Go
Raw Normal View History

2019-04-03 11:17:55 +03:00
package bundle
import (
"encoding/json"
"mapserver/vfs"
)
func getManifest(useLocal bool) *Manifest {
manifestBytes := vfs.FSMustByte(useLocal, "/manifest.js")
manifest := &Manifest{}
err := json.Unmarshal(manifestBytes, manifest)
if err != nil {
panic(err)
}
return manifest
}
func createBundle(useLocal bool, files []string) []byte {
script := make([]byte, 0)
for _, name := range files {
script = append(script, []byte("\n/*File: "+name+"*/\n")...)
content, err := vfs.FSByte(useLocal, name)
if err != nil {
panic("vfs-file not found: " + name)
}
script = append(script, content...)
}
return script
}