示例#1
0
func debugBindFS() {
	bf, err := assets.NewBindFS(&assets.BindFSConfig{
		InDir:   root,
		OutDir:  filepath.Join(tests, "debug"),
		Package: "debug",
		File:    "debug",
		Gzipped: false,
	})

	err = bf.Record()
	if err != nil {
		panic(err)
	}
}
示例#2
0
func productionBindFS() {
	bf, err := assets.NewBindFS(&assets.BindFSConfig{
		InDir:      root,
		OutDir:     filepath.Join(tests, "prod"),
		Package:    "prod",
		File:       "prod",
		Gzipped:    true,
		Production: true,
	})

	err = bf.Record()
	if err != nil {
		panic(err)
	}
}
示例#3
0
func debugCompressBindFS() {
	bf, err := assets.NewBindFS(&assets.BindFSConfig{
		InDir:           root,
		OutDir:          filepath.Join(tests, "debugnodecompress"),
		Package:         "debug",
		File:            "debug",
		Gzipped:         true,
		NoDecompression: true,
	})

	err = bf.Record()
	if err != nil {
		panic(err)
	}
}
示例#4
0
// BundleAssets creates a assets.BindFS, which when it receives any signal, updates the given file from its config
func BundleAssets(config *assets.BindFSConfig) (flux.Reactor, error) {
	bindfs, err := assets.NewBindFS(config)

	if err != nil {
		return nil, err
	}

	return flux.Reactive(func(root flux.Reactor, err error, data interface{}) {
		// bindfs.Record()
		if err := bindfs.Record(); err != nil {
			root.ReplyError(err)
			return
		}
		root.Reply(true)
	}), nil
}