Search code examples
clojureleiningencompojureluminus

Google App Engine css not loading after deployment with Luminus


I created a small application in clojure using luminus framework. When I run the app using lein run everything works well. It loads css and js properly but when I create a war file and deploy on google app engine, stylesheets don't work. I tried the solution given on this link: Serving static files with ring/compojure - from a war but it is still not working. May be there is something specific to luminus which I am missing. When I inspect it and look at console it shows this error

GET unbound: net::ERR_UNKNOWN_URL_SCHEME"

I think I am missing something in luminus Can someone help please. Thanks


Solution

  • So I figured out why this is happening. The Selmer style tag {% style "filename" %} will generate an HTML script tag and prepend the value of the servlet-context key to the URI. When servlet-context key is not present then the original URI is set. So when you give src = "css/filename" it gives the src = servlet-context + "css/filename" which can be seen in inspect. So to avoid it either do not associate servlet-context or use normal stylesheet <link> to add your static css/js files. To remove servlet-context Just comment out :servlet-context *app-context* line form render function in layout.clj file and it will start working.