如何减少 Clojurescript 中 ns 声明的大小?
How can I reduce the size of my ns declaration in Clojurescript?
我必须在 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 命名空间中包含很多声明:
(: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 ... )