50 lines
912 B
Go
50 lines
912 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed assets/*
|
|
var assetsFS embed.FS
|
|
|
|
//go:embed schemas/*
|
|
var schemasFS embed.FS
|
|
|
|
//go:embed presets.json
|
|
var presetsData []byte
|
|
|
|
//go:embed fonts.json
|
|
var fontsData []byte
|
|
|
|
//go:embed plugin.mod
|
|
var pluginModBytes []byte
|
|
|
|
// Assets returns the embedded assets filesystem.
|
|
func Assets() fs.FS {
|
|
sub, _ := fs.Sub(assetsFS, "assets")
|
|
return sub
|
|
}
|
|
|
|
// Schemas returns the embedded schemas filesystem.
|
|
func Schemas() fs.FS {
|
|
sub, _ := fs.Sub(schemasFS, "schemas")
|
|
return sub
|
|
}
|
|
|
|
// AssetsHandler returns an http.Handler that serves the embedded assets.
|
|
func AssetsHandler() http.Handler {
|
|
return http.FileServer(http.FS(Assets()))
|
|
}
|
|
|
|
// ThemePresets returns the embedded theme presets JSON.
|
|
func ThemePresets() []byte {
|
|
return presetsData
|
|
}
|
|
|
|
// BundledFonts returns the embedded fonts manifest JSON.
|
|
func BundledFonts() []byte {
|
|
return fontsData
|
|
}
|