Fix Resource context when deploying Clojure Noir to Glassfish/Tomcat
Place this in your namespace:
(:require [noir.request :as request])
Add a helper function:
(defn add-context [url]
(str (:context (request/ring-request)) url))
use it like this in hiccup:
[:script {:type "text/javascript" :src (add-context "myscript.js")}]
or better yet make a new abstract js include function:
(defpartial include-js [& scripts]
(for [script scripts]
[:script {:type "text/javascript" :src
(add-context script)}]))
Written by Brian Jesse
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Clojure
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#