forked from rosa/hakurei
32 lines
774 B
Go
32 lines
774 B
Go
//go:build frontend && frontend_test
|
|
|
|
package main
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
//go:generate mkdir ui_test/ui
|
|
//go:generate sh -c "cp ui/static/*.ts ui_test/ui/"
|
|
//go:generate tsc --outDir ui_test/static -p ui_test
|
|
//go:generate rm -r ui_test/ui/
|
|
//go:generate sass ui_test/lib/ui.scss ui_test/static/style.css
|
|
//go:generate cp ui_test/lib/ui.html ui_test/static/index.html
|
|
//go:generate sh -c "cd ui_test/lib && cp *.svg ../static/"
|
|
//go:embed ui_test/static
|
|
var _staticTest embed.FS
|
|
|
|
var staticTest = func() fs.FS {
|
|
if f, err := fs.Sub(_staticTest, "ui_test/static"); err != nil {
|
|
panic(err)
|
|
} else {
|
|
return f
|
|
}
|
|
}()
|
|
|
|
func testUIRoutes(mux *http.ServeMux) {
|
|
mux.Handle("GET /test/", http.StripPrefix("/test", http.FileServer(http.FS(staticTest))))
|
|
}
|