Closed sheepduke closed 6 years ago
How about using the static file middleware as described here: https://github.com/fukamachi/lack
Thanks for your reply.
However, the example in lack
just does not work, so I gave it up after a glance.
By the way I found the solution myself.
I did not set the :content-type
while returning static files. Thus CSS/JS files are treated as HTML, which led to unexpected result. So in clack
I need to manually write static file handlers.
It is not easy to cover all MIME types. Hunchentoot
has a mime-types.lisp
file that is worth seeing...
EDIT: Add an example for potential needs from other people. Something like this:
`(200 (:content-type "text/css") ("p { color: red;}"))
Hey,
This may sound stupid, but how am I supposed to handle static files (i.e. CSS, JS etc) using clack?
For example
Hunchentoot
has a function to dispatch static files.How can I achieve the same thing using clack so that CSS/JS files included by HTML can be handled properly? Or I have to create my own find-and-replace stuff to inject CSS/JS files into HTML?
I searched around for a long time but no luck. Thanks.