diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-23 15:33:13 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-24 07:11:24 +0700 |
| commit | 62c2e03409e8f7bc6f3f20df36603344afaf2b3a (patch) | |
| tree | 0235899db041244ecabc754ca636d7bbd651d1e0 /internal/cmd/staticfs | |
| parent | 8970c0fef45c87c183a27f8a66d9620fdb6daa1e (diff) | |
| download | ciigo-62c2e03409e8f7bc6f3f20df36603344afaf2b3a.tar.xz | |
all: embed CSS and index HTML template using memfs
Previously, with direct embed, every time we change the CSS or index
template, we need to restart the "ciigo serve" command.
Using memfs make us easy to update and see the changes directly, without
restarting the server.
Diffstat (limited to 'internal/cmd/staticfs')
| -rw-r--r-- | internal/cmd/staticfs/main.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/cmd/staticfs/main.go b/internal/cmd/staticfs/main.go new file mode 100644 index 0000000..edcd080 --- /dev/null +++ b/internal/cmd/staticfs/main.go @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2026 Shulhan <ms@kilabit.info> + +package main + +import ( + "log" + + "git.sr.ht/~shulhan/pakakeh.go/lib/memfs" +) + +func main() { + var opts = &memfs.Options{ + Embed: memfs.EmbedOptions{ + PackageName: `ciigo`, + VarName: `staticfs`, + GoFileName: `staticfs.go`, + CommentHeader: `// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2026 Shulhan <ms@kilabit.info> + +`, + }, + Root: `./_static`, + } + + staticfs, err := memfs.New(opts) + if err != nil { + log.Fatal(err) + } + + err = staticfs.GoEmbed() + if err != nil { + log.Fatal(err) + } +} |
