Improve asset
This commit is contained in:
parent
5d1cbd4b9f
commit
4cc94d5090
6 changed files with 18 additions and 12 deletions
src
|
@ -3,7 +3,7 @@
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:local-nicknames (#:jg #:jingle))
|
||||||
(:local-nicknames (#:fbr #:ningle-fbr))
|
(:local-nicknames (#:fbr #:ningle-fbr))
|
||||||
(:local-nicknames (#:cfg #:hp/config/*))
|
(:local-nicknames (#:cfg #:hp/config/env))
|
||||||
(:local-nicknames (#:asset #:hp/view/asset))
|
(:local-nicknames (#:asset #:hp/view/asset))
|
||||||
(:local-nicknames (#:mw #:hp/middlewares/*))
|
(:local-nicknames (#:mw #:hp/middlewares/*))
|
||||||
(:export #:start
|
(:export #:start
|
||||||
|
|
12
src/config/asset.lisp
Normal file
12
src/config/asset.lisp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
(defpackage #:hp/config/asset
|
||||||
|
(:use #:cl)
|
||||||
|
(:export #:*asset-roots*))
|
||||||
|
(in-package #:hp/config/asset)
|
||||||
|
|
||||||
|
(defparameter *asset-roots*
|
||||||
|
'(:img "/img/"
|
||||||
|
:css "/css/"
|
||||||
|
:js "/js/"
|
||||||
|
:vendor "/vendor/"
|
||||||
|
:htmx-ext "/vendor/htmx-ext/"
|
||||||
|
:alpine-ext "/vendor/alpine-ext/"))
|
|
@ -1,7 +1,7 @@
|
||||||
(defpackage #:hp/routes/about
|
(defpackage #:hp/routes/about
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:pi #:piccolo))
|
(:local-nicknames (#:pi #:piccolo))
|
||||||
(:local-nicknames (#:view #:hp/view/**/*))
|
(:local-nicknames (#:view #:hp/view/*))
|
||||||
(:export #:handle-get))
|
(:export #:handle-get))
|
||||||
(in-package #:hp/routes/about)
|
(in-package #:hp/routes/about)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(defpackage #:hp/routes/index
|
(defpackage #:hp/routes/index
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:pi #:piccolo))
|
(:local-nicknames (#:pi #:piccolo))
|
||||||
(:local-nicknames (#:view #:hp/view/**/*))
|
(:local-nicknames (#:view #:hp/view/*))
|
||||||
(:export #:handle-get))
|
(:export #:handle-get))
|
||||||
(in-package #:hp/routes/index)
|
(in-package #:hp/routes/index)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:local-nicknames (#:jg #:jingle))
|
||||||
(:local-nicknames (#:pi #:piccolo))
|
(:local-nicknames (#:pi #:piccolo))
|
||||||
(:local-nicknames (#:view #:hp/view/**/*))
|
(:local-nicknames (#:view #:hp/view/*))
|
||||||
(:export #:handle-not-found))
|
(:export #:handle-not-found))
|
||||||
(in-package #:hp/routes/not-found)
|
(in-package #:hp/routes/not-found)
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
(defpackage #:hp/view/asset
|
(defpackage #:hp/view/asset
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:re #:cl-ppcre))
|
(:local-nicknames (#:re #:cl-ppcre))
|
||||||
|
(:local-nicknames (#:cfg #:hp/config/asset))
|
||||||
(:export #:asset-root
|
(:export #:asset-root
|
||||||
#:define-assets
|
#:define-assets
|
||||||
#:get-css-paths
|
#:get-css-paths
|
||||||
#:cmp-props))
|
#:cmp-props))
|
||||||
(in-package #:hp/view/asset)
|
(in-package #:hp/view/asset)
|
||||||
|
|
||||||
(defparameter *asset-roots*
|
|
||||||
'(:css "/css/"
|
|
||||||
:js "/js/"
|
|
||||||
:vendor "/vendor/"
|
|
||||||
:htmx-ext "/vendor/htmx-ext/"
|
|
||||||
:alpine-ext "/vendor/alpine-ext/"))
|
|
||||||
|
|
||||||
(defun asset-root (kind)
|
(defun asset-root (kind)
|
||||||
(getf *asset-roots* kind))
|
(getf cfg:*asset-roots* kind))
|
||||||
|
|
||||||
(defun asset-path (kind path)
|
(defun asset-path (kind path)
|
||||||
(concatenate 'string (asset-root kind) path))
|
(concatenate 'string (asset-root kind) path))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue