Back
include-js (clj)
(source)function
(include-js & scripts)
Include a list of external javascript files.
Examples
hiccup
(ns hiccup.page_test
(:require [clojure.test :refer :all]
[hiccup.page :refer :all])
(:import java.net.URI))
(deftest include-js-test
(is (= (include-js "foo.js")
(list [:script {:type "text/javascript", :src (URI. "foo.js")}])))
(is (= (include-js "foo.js" "bar.js")
(list [:script {:type "text/javascript", :src (URI. "foo.js")}]
[:script {:type "text/javascript", :src (URI. "bar.js")}]))))
Deraen/saapas
(ns backend.index
(:require
[hiccup.core :refer [html]]
[hiccup.page :refer [html5 include-js include-css]]))
(def index-page
(html
(html5
[:head
[:title "Saapas"]
[:meta {:charset "utf-8"}]
[:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
[:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]
(include-css "css/main.css")]
[:body
[:div.container [:div#app.app-wrapper]]
(include-js "js/main.js")])))
(def test-page
(html
(html5
[:head
[:title "Saapas tests"]]
[:body
[:div.container [:div#app.app-wrapper]]
(include-js "js/test.js")])))
sneerteam/sneer
(ns reagent-spike.handler
(:require [compojure.core :refer [GET defroutes]]
[compojure.route :refer [not-found resources]]
[hiccup.page :refer [include-js include-css html5]]
[reagent-spike.middleware :refer [wrap-middleware]]
[environ.core :refer [env]]))
(def loading-page
(html5
[:head
[:meta {:charset "utf-8"}]
[:meta {:name "viewport"
:content "width=device-width, initial-scale=1"}]
(include-css (if (env :dev) "/css/site.css" "/css/site.min.css"))]
[:body
mount-target
(include-js "/js/app.js")]))
jcouyang/gh-omnibar
(ns github-omnibar.handler
(:require [compojure.core :refer [GET defroutes]]
[compojure.route :refer [not-found resources]]
[hiccup.page :refer [include-js include-css html5]]
[github-omnibar.middleware :refer [wrap-middleware]]
[environ.core :refer [env]]))
(def loading-page
(html5
[:head
[:meta {:charset "utf-8"}]
[:meta {:name "viewport"
:content "width=device-width, initial-scale=1"}]
(include-css "/css/github.css")
(include-css "/css/frameworks.css")
(include-js "/js/jquery.min.js")
(include-js "/js/string_score.js")
(include-css "/css/site.css")
]
[:body
mount-target
(include-js "/js/app.js")]))
robert-stuttaford/demo-enfocus-pubsub-remote
(ns depr.views.main
(:require [noir.core :as noir]
[hiccup.page :as page]
[hiccup.element :as element]))
(noir/defpartial js-app
[js]
(list
;; avoid loading deps.js in whitespace mode
(if (re-find #"debug" js) (element/javascript-tag "var CLOSURE_NO_DEPS = true;"))
(page/include-js (str "/js/" js ".js"))
(element/javascript-tag "depr.app.run()")))
domgetter/typerooni
(ns typerooni.handler
(:require [compojure.core :refer [GET defroutes]]
[compojure.route :refer [not-found resources]]
[hiccup.core :refer [html]]
[hiccup.page :refer [include-js include-css]]
[typerooni.middleware :refer [wrap-middleware]]
[environ.core :refer [env]]))
(def loading-page
(html
[:html
[:head
[:meta {:charset "utf-8"}]
[:meta {:name "viewport"
:content "width=device-width, initial-scale=1"}]
(include-css (if (env :dev) "css/site.css" "css/site.min.css"))]
[:body
mount-target
(include-js "js/app.js")]]))