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 /server.go | |
| 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 'server.go')
| -rw-r--r-- | server.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: 2019 Shulhan <ms@kilabit.info> // SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2019 Shulhan <ms@kilabit.info> package ciigo @@ -44,6 +44,9 @@ func (ciigo *Ciigo) InitHTTPServer(opts ServeOptions) (err error) { } else { opts.Mfs.Opts.TryDirect = opts.IsDevelopment } + if staticfs != nil { + staticfs.Opts.TryDirect = opts.IsDevelopment + } ciigo.serveOpts = opts @@ -209,7 +212,7 @@ func (ciigo *Ciigo) onGet( return node, 0 } var err error - if isNew || ciigo.converter.shouldConvert(fmarkup) { + if isNew || ciigo.converter.shouldConvert(fmarkup, ciigo.serveOpts.IsDevelopment) { err = ciigo.converter.ToHTMLFile(fmarkup) if err != nil { log.Printf(`%s: failed to convert markup file %q: %s`, |
