Refactor Tailwind CSS server handling
This commit is contained in:
parent
7bddd59dab
commit
340dd47e0d
5 changed files with 16 additions and 13 deletions
14
Makefile
14
Makefile
|
@ -1,4 +1,4 @@
|
||||||
TAILWINDCSS_URL=https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64
|
TAILWIND_URL=https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64
|
||||||
TAILWIND_TARGET=tailwindcss-macos-arm64
|
TAILWIND_TARGET=tailwindcss-macos-arm64
|
||||||
BIN_DIR=./bin
|
BIN_DIR=./bin
|
||||||
TAILWIND_BIN=$(BIN_DIR)/tailwindcss
|
TAILWIND_BIN=$(BIN_DIR)/tailwindcss
|
||||||
|
@ -11,7 +11,7 @@ install: ## Download TailwindCSS binary and install other dependencies
|
||||||
@echo "Creating bin directory if it doesn't exist..."
|
@echo "Creating bin directory if it doesn't exist..."
|
||||||
mkdir -p $(BIN_DIR)
|
mkdir -p $(BIN_DIR)
|
||||||
@echo "Downloading TailwindCSS binary..."
|
@echo "Downloading TailwindCSS binary..."
|
||||||
curl -sLO $(TAILWINDCSS_URL)
|
curl -sLO $(TAILWIND_URL)
|
||||||
@echo "Making TailwindCSS binary executable..."
|
@echo "Making TailwindCSS binary executable..."
|
||||||
chmod +x $(TAILWIND_TARGET)
|
chmod +x $(TAILWIND_TARGET)
|
||||||
@echo "Moving TailwindCSS binary to $(BIN_DIR)..."
|
@echo "Moving TailwindCSS binary to $(BIN_DIR)..."
|
||||||
|
@ -32,4 +32,12 @@ help: ## Display available commands and their descriptions
|
||||||
|
|
||||||
clean: ## Remove the bin directory and clean up generated files
|
clean: ## Remove the bin directory and clean up generated files
|
||||||
@echo "Removing $(BIN_DIR)..."
|
@echo "Removing $(BIN_DIR)..."
|
||||||
rm -rf $(BIN_DIR)
|
rm -rf $(BIN_DIR)
|
||||||
|
|
||||||
|
lem: ## Open Lem with TailwindCSS server
|
||||||
|
@echo "Starting make watch in background..."
|
||||||
|
@make watch > /dev/null 2>&1 & \
|
||||||
|
WATCH_PID=$$!; \
|
||||||
|
trap "kill $$WATCH_PID" SIGINT SIGTERM EXIT; \
|
||||||
|
lem; \
|
||||||
|
kill $$WATCH_PID
|
|
@ -11,8 +11,6 @@
|
||||||
(defparameter *app* (jg:make-app :address "localhost"
|
(defparameter *app* (jg:make-app :address "localhost"
|
||||||
:port env:*port*))
|
:port env:*port*))
|
||||||
|
|
||||||
(jg:clear-middlewares *app*)
|
|
||||||
(jg:clear-routing-rules *app*)
|
|
||||||
(fbr:assign-routes *app* :system "hp" :directory "src/routes")
|
(fbr:assign-routes *app* :system "hp" :directory "src/routes")
|
||||||
(jg:install-middleware *app* mw:*recoverer*)
|
(jg:install-middleware *app* mw:*recoverer*)
|
||||||
(jg:install-middleware *app* mw:*path-normalizer*)
|
(jg:install-middleware *app* mw:*path-normalizer*)
|
||||||
|
|
|
@ -10,16 +10,10 @@
|
||||||
#:update))
|
#:update))
|
||||||
(in-package #:hp)
|
(in-package #:hp)
|
||||||
|
|
||||||
(defparameter *watch-process* nil)
|
|
||||||
|
|
||||||
(defun start ()
|
(defun start ()
|
||||||
(when (env:dev-mode-p)
|
|
||||||
(setf *watch-process* (uiop:launch-program "make watch")))
|
|
||||||
(jg:start *app*))
|
(jg:start *app*))
|
||||||
|
|
||||||
(defun stop ()
|
(defun stop ()
|
||||||
(when (env:dev-mode-p)
|
|
||||||
(uiop:terminate-process *watch-process*))
|
|
||||||
(jg:stop *app*))
|
(jg:stop *app*))
|
||||||
|
|
||||||
(defun update ()
|
(defun update ()
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
(defpackage #:hp/renderer
|
(defpackage #:hp/renderer
|
||||||
(:use #:cl
|
(:use #:cl
|
||||||
#:hsx)
|
#:hsx)
|
||||||
(:local-nicknames (#:jg #:jingle)))
|
(:local-nicknames (#:jg #:jingle))
|
||||||
|
(:local-nicknames (#:env #:hp/env)))
|
||||||
(in-package #:hp/renderer)
|
(in-package #:hp/renderer)
|
||||||
|
|
||||||
(defcomp document (&key title description children)
|
(defcomp document (&key title description children)
|
||||||
|
@ -26,6 +27,8 @@
|
||||||
|
|
||||||
(defmethod jg:process-response ((app jg:app) result)
|
(defmethod jg:process-response ((app jg:app) result)
|
||||||
(jg:set-response-header :content-type "text/html; charset=utf-8")
|
(jg:set-response-header :content-type "text/html; charset=utf-8")
|
||||||
|
(when (env:dev-mode-p)
|
||||||
|
(jg:set-response-header :cache-control "no-store"))
|
||||||
(call-next-method app
|
(call-next-method app
|
||||||
(hsx:render-to-string
|
(hsx:render-to-string
|
||||||
(if (listp result)
|
(if (listp result)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
open: false,
|
open: false,
|
||||||
get isOpen() { return this.open },
|
get isOpen() { return this.open },
|
||||||
toggle() { this.open = ! this.open },
|
toggle() { this.open = ! this.open },
|
||||||
}"
|
}"
|
||||||
(button :@click "toggle()"
|
(button :@click "toggle()"
|
||||||
"Toggle")
|
"Toggle")
|
||||||
(div :x-show "isOpen"
|
(div :x-show "isOpen"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue