Open practice opened 8 years ago
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html 에도 설명이 있고, https://github.com/clojure/clojurescript/wiki/Dependencies 에도 설명이 있다.
다 읽기 귀찮은데, 간단한 결론은 이렇다.
http://cljsjs.github.io 에서 잘 알려진 javascript 라이브러리를 clojurescript 에서 사용하기 쉽도록 패키징한 것들을 관리하고 있다. 그래서 project.clj 파일에 의존관계만 적어주면 된다.
나 같은 경우 jquery, bootstrap 이 필요했는데
[cljsjs/jquery "2.1.4-0"] [cljsjs/bootstrap "3.3.6-0"]
위 두 줄만 추가하면 된다. 그런데 사실 jquery 의존성은 필요 없다. bootstrap의존성만 지정하면 된다. bootstrap이 jquery 의존성을 가지고 있으므로 자동으로 같이 가져온다.
그 다음 다음과 같이 하자.
core.cljs 에서 (어느 파일에서 하건 상관없는 것 같다)
(ns myweb.core (:require [cljsjs.jquery] [cljsjs.bootstrap]))
사용할 때,
(defn xxx [] ... (.modal (js/$ "#my-modal-id") "show"))
이게 끝이다.
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html 에도 설명이 있고, https://github.com/clojure/clojurescript/wiki/Dependencies 에도 설명이 있다.
다 읽기 귀찮은데, 간단한 결론은 이렇다.
http://cljsjs.github.io 에서 잘 알려진 javascript 라이브러리를 clojurescript 에서 사용하기 쉽도록 패키징한 것들을 관리하고 있다. 그래서 project.clj 파일에 의존관계만 적어주면 된다.
나 같은 경우 jquery, bootstrap 이 필요했는데
위 두 줄만 추가하면 된다. 그런데 사실 jquery 의존성은 필요 없다. bootstrap의존성만 지정하면 된다. bootstrap이 jquery 의존성을 가지고 있으므로 자동으로 같이 가져온다.
그 다음 다음과 같이 하자.
core.cljs 에서 (어느 파일에서 하건 상관없는 것 같다)
사용할 때,
이게 끝이다.