我必须在 clojurescript 命名空间中包含大量声明:
(:use-macros
[webapp.framework.client.coreclient
:only [ns-coils sql log neo4j neo4j-1 sql-1 log
watch-data -->ui <--data <--ui
watch-ui remote defn-ui-component
container map-many inline text
div img pre component h2 input
write-ui read-ui container
inline text admin ==data ==ui -->ui watch-ui <--ui
<--data -->data remote inputcomponent <--
h1 h2 h3 h4 h5 h6 span data-view-v2
watch-data map-many inline text
container <--pos <--id session-user-id select select-debug
def-coils-app
]])
有什么方法可以将其减少为:
(:use-macros
[webapp.framework.client.coreclient])
?
最佳答案
与可以使用 :refer :all 的 clojure 相比,这在 clojurescript 中是不可能的。您可以在这里找到正确的答案:
Is it possible to use :refer :all in a ClojureScript :require?
但是,您可以这样做:
(:require-macros
[webapp.framework.client.coreclient :as client])
然后您可以像这样引用此命名空间中的任何宏:
(client/div ... )
关于clojurescript - 如何减少 Clojurescript 中 ns 声明的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31035536/