From 32e7fe5f94eee7e08f048d1ead1e7e82f29c46d6 Mon Sep 17 00:00:00 2001 From: herkulessi Date: Wed, 20 Aug 2025 20:13:09 +0200 Subject: Initial commit of libmkwebpage --- static.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 static.go (limited to 'static.go') diff --git a/static.go b/static.go new file mode 100644 index 0000000..04c0fe6 --- /dev/null +++ b/static.go @@ -0,0 +1,14 @@ +package libmkwebpage + +import ( + "embed" + "io/fs" + "net/http" +) + +func (w *Webpage) NewStaticFiles(pattern string, static embed.FS, dynamic fs.FS) *Webpage { + w.HandlerDynamic("GET "+pattern, http.FileServerFS(dynamic)) + w.HandlerStatic("GET "+pattern, http.FileServerFS(static)) + w.staticFilePrefix = pattern + return w +} -- cgit v1.2.3