mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
more CSS styling
This commit is contained in:
@@ -14,7 +14,6 @@ var embed_cache sync.Map
|
||||
// INFO: We initialize the cache in both functions, which is only valid if both of these get
|
||||
// called in the same context, eg. when creating a template engine.
|
||||
func EmbedSafe(fs fs.FS) func(string) template.HTML {
|
||||
embed_cache.Clear()
|
||||
return func(path string) template.HTML {
|
||||
path = strings.TrimSpace(path)
|
||||
path = filepath.Clean(path)
|
||||
@@ -28,7 +27,6 @@ func EmbedSafe(fs fs.FS) func(string) template.HTML {
|
||||
}
|
||||
|
||||
func Embed(fs fs.FS) func(string) string {
|
||||
embed_cache.Clear()
|
||||
return func(path string) string {
|
||||
path = strings.TrimSpace(path)
|
||||
path = filepath.Clean(path)
|
||||
@@ -41,6 +39,10 @@ func Embed(fs fs.FS) func(string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func ClearEmbedCache() {
|
||||
embed_cache.Clear()
|
||||
}
|
||||
|
||||
func getFileData(fs fs.FS, path string) ([]byte, error) {
|
||||
if val, ok := embed_cache.Load(path); ok {
|
||||
return val.([]byte), nil
|
||||
|
||||
Reference in New Issue
Block a user