From 74035544e7fce17cd91158e4d5e145abe4a3cfd2 Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Sun, 30 Mar 2025 17:13:52 +0900 Subject: [PATCH 1/2] Rename "public" to "static" --- .gitignore | 2 +- Dockerfile | 2 +- Makefile | 4 ++-- src/app.lisp | 4 ++-- {public => static}/img/favicon.ico | Bin {public => static}/img/me.webp | Bin {public => static}/img/og.jpg | Bin {public => static}/style/global.css | 0 8 files changed, 6 insertions(+), 6 deletions(-) rename {public => static}/img/favicon.ico (100%) rename {public => static}/img/me.webp (100%) rename {public => static}/img/og.jpg (100%) rename {public => static}/style/global.css (100%) diff --git a/.gitignore b/.gitignore index 23d910b..790aa7c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .qlot bin/tailwindcss -public/style/dist.css +static/style/dist.css .env diff --git a/Dockerfile b/Dockerfile index a73b125..8f8df9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN mkdir -p ./bin \ && chmod +x tailwindcss-linux-x64 \ && mv tailwindcss-linux-x64 ./bin/tailwindcss -RUN ./bin/tailwindcss -i ./public/style/global.css -o ./public/style/dist.css --minify +RUN ./bin/tailwindcss -i ./static/style/global.css -o ./static/style/dist.css --minify RUN qlot install --quiet diff --git a/Makefile b/Makefile index b5ba028..adc5773 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ TAILWIND_URL=https://github.com/tailwindlabs/tailwindcss/releases/latest/downloa TAILWIND_TARGET=tailwindcss-macos-arm64 BIN_DIR=./bin TAILWIND_BIN=$(BIN_DIR)/tailwindcss -STYLE_SRC=./public/style/global.css -STYLE_DIST=./public/style/dist.css +STYLE_SRC=./static/style/global.css +STYLE_DIST=./static/style/dist.css all: install diff --git a/src/app.lisp b/src/app.lisp index ac13d5e..d653c10 100644 --- a/src/app.lisp +++ b/src/app.lisp @@ -20,8 +20,8 @@ (set-routes app :system :hp :target-dir-path "routes") (install-middleware app *recoverer*) (install-middleware app *trim-trailing-slash*) - (static-path app "/img/" "public/img/") - (static-path app "/style/" "public/style/") + (static-path app "/img/" "static/img/") + (static-path app "/style/" "static/style/") (configure app))) *app* diff --git a/public/img/favicon.ico b/static/img/favicon.ico similarity index 100% rename from public/img/favicon.ico rename to static/img/favicon.ico diff --git a/public/img/me.webp b/static/img/me.webp similarity index 100% rename from public/img/me.webp rename to static/img/me.webp diff --git a/public/img/og.jpg b/static/img/og.jpg similarity index 100% rename from public/img/og.jpg rename to static/img/og.jpg diff --git a/public/style/global.css b/static/style/global.css similarity index 100% rename from public/style/global.css rename to static/style/global.css From 63f1bfb819a22ec622a926a8f90971011f7af8d7 Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Sun, 30 Mar 2025 17:14:24 +0900 Subject: [PATCH 2/2] Improve cache control --- src/renderer.lisp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/renderer.lisp b/src/renderer.lisp index 4da0b08..a127fcc 100644 --- a/src/renderer.lisp +++ b/src/renderer.lisp @@ -72,10 +72,9 @@ (defmethod jingle:process-response ((app jingle:app) result) (set-response-header :content-type "text/html; charset=utf-8") - (when (string= (hp-env) "dev") - (set-response-header :cache-control "no-store, no-cache, must-revalidate") - (set-response-header :pragma "no-cache") - (set-response-header :expires "0")) + (set-response-header :cache-control (if (string= (hp-env) "dev") + "no-store, no-cache, must-revalidate" + "public, max-age=0, must-revalidate, s-maxage=60, stale-while-revalidate=60")) (call-next-method app (hsx:render-to-string (match result