react-mdl Reagent.
project.clj:
[reagent "0.6.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "15.3.1-0"]
[cljsjs/react-mdl "1.5.4-0"]
:
(ns ,,,
(:require ,,,
[cljsjs.react-mdl]))
, :
(def Button (.-Button js/ReactMDL))
(def Slider (.-Slider js/ReactMDL))
,,,
Reagent :
[:> Button "Hello!"]
[:> Slider {:min 0 :max 10}]
react-mdl CSS HTML.
The CSS file is embedded inside the package cljsjs/react-mdl. To extract it, I used ring-cljsjs middleware:
; Add dependencies to project.clj
[ring-cljsjs "0.1.0"]
[cljsjs/react-mdl "1.5.4-0"]
; Apply middleware to the Ring handler
(ns app.handler
(:require ,,,
[ring.middleware.cljsjs :refer [wrap-cljsjs]]))
,,,
(-> ,,,
wrap-cljsjs)
; Add link to CSS into Hiccup template for the served HTML file
(ns ,,,
(:require ,,,
[hiccup.page :as h]))
,,,
[:head
[:meta {:charset "UTF-8"}]
[:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
(h/include-css "/cljsjs/react-mdl/material.min.css")
,,,
Other ways to extract assets without JS from packages are cljsjsdescribed in the project wiki .