Skip to content

Embedding Assets

You can embed assets into your binary so that you don’t have to carry around your app/dist directory.

Use WithEfs() to set the server’s embedded file system.

package main
import (
"embed"
"github.com/razshare/frizzante/frz"
)
//go:embed app/dist
var efs embed.FS
func main() {
frz.NewServer().
WithEfs(efs).
Start()
}

Not only serving a file with SendFileOrElse() also takes into account the embedded file system, but your views’ bundles are also included in the embedded file system, which makes your final binary completely standalone.