From 62c2e03409e8f7bc6f3f20df36603344afaf2b3a Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 23 Jan 2026 15:33:13 +0700 Subject: 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. --- server.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'server.go') diff --git a/server.go b/server.go index 8a35fad..2fe26c9 100644 --- a/server.go +++ b/server.go @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: 2019 Shulhan // SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2019 Shulhan 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`, -- cgit v1.3