Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/cyberpunk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
61 lines
1.4 KiB
Go
61 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
|
|
"git.dev.alexdunmow.com/block/core/plugin"
|
|
)
|
|
|
|
//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 (rooted at "assets/").
|
|
func Assets() fs.FS {
|
|
sub, _ := fs.Sub(assetsFS, "assets")
|
|
return sub
|
|
}
|
|
|
|
// Schemas returns the embedded schemas filesystem (rooted at "schemas/").
|
|
func Schemas() fs.FS {
|
|
sub, _ := fs.Sub(schemasFS, "schemas")
|
|
return sub
|
|
}
|
|
|
|
// AssetsHandler returns an http.Handler that serves the embedded assets at /templates/cyberpunk/...
|
|
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 }
|
|
|
|
// ThemeCSSManifest exposes the theme's custom CSS (scanlines, glitch, neon-edge,
|
|
// caret-blink keyframes, font-family fallbacks) to the host Tailwind input so the
|
|
// utilities survive prod purging.
|
|
func ThemeCSSManifest() *plugin.CSSManifest {
|
|
css, err := assetsFS.ReadFile("assets/css/cyberpunk.css")
|
|
if err != nil {
|
|
return &plugin.CSSManifest{}
|
|
}
|
|
return &plugin.CSSManifest{
|
|
InputCSSAppend: string(css),
|
|
}
|
|
}
|