如何将图书馆(clojars)集成到Lightable插件 [英] How to integrate libraries (clojars) into Lightable plugins
问题描述
作为练习获得ClojureScript的经验我编写一个LightTable插件,我找不到成功使用任何标准库,我阅读官方文档,甚至更新它,以反映关于路径等的最新变化。我跟着这个< a href =https://www.youtube.com/watch?v=j91Li9kL0t8&feature=youtu.be =nofollow>视频,并阅读 google group 尝试提出的解决方案,甚至使用最新的github源没有运气。
我试过包括 core.async
或 cljs.http
(我知道嵌入式nodejs替代,只是作为例子)遵循建议的工作流程由Irakli在谷歌讨论。最简单的方案:
$ lein版本
Leiningen 2.5.0 on Java 1.7 .0_55 Java HotSpot(TM)64位服务器VM(Mac OS X 10.9.5)和LT最新(0.7.2)
$ lein新的插件样例
插件project.clj - >
示例0.0.1
:dependencies [[org.clojure / clojure1.5.1]
[cljs-http0.1.20]
])
核心文件
(ns lt.plugins.sample
(:require [lt.object:as object]
[lt.objs.tabs:as tabs]
[lt.objs.command:as cmd]
[cljs-http.client:as http]
)
(:require-macros [lt.macros:refer [defui behavior]]))
defn get-users
[]
(let [response(http / gethttps://api.github.com/users{:with-credentials?false}) ]
(prn(:status response))
(prn(map:login(:body response)))));正确评估
(get-users);负载的错误如
警告:引用var clojure.string / split不存在第1行文件:/Users/jaime/.m2/repository/noencore/noencore/0.1.16/noencore-0.1 .16.jar!/no/en/core.cljs
我运行lein deps,save,reload行为,重新启动,刷新插件列表...所有可能的组合尝试,与插件文件夹
〜/ Library / Application Support / LightTable / plugins
我应该下载jar并手动将它们放到lib文件夹中吗?我想
lein deps
不能正常工作。解决方案似乎Cljs本机或Cljx的事情,不能与LightTable UI产生良好的谐振。
尝试 https://github.com/swannodette/om/wiki/Basic-Tutorial ,你会发现它不需要太多。您可以创建LT键绑定以打开浏览器选项卡,导航到项目文件夹
index.html
,并使另一个重新加载(因为autoreload是我正在进行的工作)。然后另一个带有Cljs文件的标签,同时你使cljsbuild自动运行,刷新浏览器和更改应该可以见证。As exercise to gain experience with ClojureScript I am writing a LightTable Plugin and I find no way to successfully use any standard library, I read the official documentation and even updated it to reflect latest changes regarding paths etc.. I followed this video and read the whole thread on the google group trying the proposed solutions, even working with the latest github source without luck.
I tried including
core.async
orcljs.http
(I know the embedded nodejs alternative, just as example) following the proposed workflow by Irakli on the Google discussion. Simplest possible scenario:$ lein version Leiningen 2.5.0 on Java 1.7.0_55 Java HotSpot(TM) 64-Bit Server VM (Mac OS X 10.9.5) and LT latest (0.7.2) $ lein new lt-plugin sample
plugin project.clj->
(defproject sample "0.0.1" :dependencies [[org.clojure/clojure "1.5.1"] [cljs-http "0.1.20"] ])
core file
(ns lt.plugins.sample (:require [lt.object :as object] [lt.objs.tabs :as tabs] [lt.objs.command :as cmd] [cljs-http.client :as http] ) (:require-macros [lt.macros :refer [defui behavior]])) (defn get-users "" [] (let [response (http/get "https://api.github.com/users" {:with-credentials? false})] (prn (:status response)) (prn (map :login (:body response))))) ; evaluated correctly (get-users) ; loads of errors like WARNING: Referred var clojure.string/split does not exist at line 1 file:/Users/jaime/.m2/repository/noencore/noencore/0.1.16/noencore-0.1.16.jar!/no/en/core.cljs
I run lein deps, save, reload behaviours, restart, refresh plugin lists... all possible combinations tried, with the plugin folder within
~/Library/Application Support/LightTable/plugins
or outside.Should I download the jars and put them manually into a lib folder? I guess
lein deps
is not working as I expect解决方案Yes currently seems that Cljs native or Cljx for that matter, doesn't resonate well with the LightTable UI.
Trying https://github.com/swannodette/om/wiki/Basic-Tutorial you'll find that it doesn't take much. You can create a LT keybinding to open browser tab, navigate to project folder
index.html
and make another for reloading (as autoreload is a work in progress I think). Then another tab with the Cljs file while you have the cljsbuild auto running, refresh browser and changes should be witnessed.这篇关于如何将图书馆(clojars)集成到Lightable插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!