Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set content-type for css when using a different template library #140

Open
mooseyboots opened this issue Apr 20, 2023 · 3 comments
Open

Comments

@mooseyboots
Copy link

i was trying out ningle with spinneret, then thought to try caveman with spinneret also. i'm having trouble with handling static resources though.

if i take the caveman skeleton project, and change the main route to be:

(defroute "/" ()
  (spinneret:with-html-string
    (:doctype)
    (:html
     (:head
      (:title "test")
      (:link :type "image/png" :rel "icon" :href "/favicon.png")
      (:link :type "text/css" :rel "stylesheet" :href "main.css")
     (:body
      (:h1 "my stuff")

the css doesn't load, and the browser console errors:

The resource from “http://localhost:5000/main.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).`

I'm unsure how to set the content-type in this case, as i'm trying to handle different types in the one route. is it not possible to write routes like this?

@mooseyboots
Copy link
Author

i tried out the cl-who who library mentioned in the readme, and i have the same issue.

@vindarel
Copy link
Contributor

Is it working with the default Caveman, using Djula templates?

Did you write something more, a route definition?

set content-type for css

I don't think you'd write a route and set the content type, but you'd configure the web server (Clack) to serve static assets from a directory. That seems to be done by default somewhere.

(not a Caveman connoisseur, helping you brainstorm)

@mooseyboots
Copy link
Author

hi @vindarel thanks for chiming in. (and for all your CL resources! they're great, CL needs lots more docs for newcomers, and i say that as sb who knows lisp but not CL specifically.)

yes static assets work with the default set up. that's actually why i tried this out as i had trouble getting ningle to work with static assets and spinneret.

for now i have solved the issue using ningle, after lots of tears.

it would be good for more ningle/caveman/clack/lack to have more documentation. i all they have and after about 10 minutes of hacking i had already run into issues the docs don't mention at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants