2

I have to include a lot of declarations in clojurescript namespace:

(: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
           ]])

Is there any way to reduce this to something like:

(:use-macros
    [webapp.framework.client.coreclient])

?

yazz.com
  • 57,320
  • 66
  • 234
  • 385

1 Answers1

4

In comparison to clojure where it would be possible to use :refer :all it is not possible in clojurescript. You can find the proper answer in here :

Is it possible to use :refer :all in a ClojureScript :require?

However, you can do is this:

(:require-macros 
  [webapp.framework.client.coreclient :as client])

And then you can refer to any macro in this namespace like this :

(client/div ... )
Community
  • 1
  • 1
Viktor K.
  • 2,670
  • 2
  • 19
  • 30
  • The reason I am doing this is so that I do not have to do the "client/div" type prefix every time I use an element – yazz.com Jun 25 '15 at 13:35
  • 1
    That's considered a bad practice and therefore it wasn't introduced to Clojurescript and it won't be. https://groups.google.com/forum/#!searchin/clojurescript/refer$20all/clojurescript/SzYK08Oduxo/p0bWhM5lftUJ – Viktor K. Jun 25 '15 at 13:39