For what you're trying to do, :externs is not the solution.

Ultimately, all you need to do is make sure that both src-cljs/live and 
src-cljs/test are on the classpath at compile time.  The easiest way to do 
this would be to put both builds into the same project:

:builds
{:live {:source-path "src-cljs/live" :compiler {...}}
 :test {:source-path "src-cljs/test" :compiler {...}}}

When :builds contains multiple entries, they are all added to the 
classpath, and thus helper.webTemplateTest will be able to load 
helper.webTemplate.

:externs is used for a totally different purpose (JavaScript interop).  If 
you want to learn more about that, I recommend reading this: 
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
 .

-Evan

On Thursday, October 25, 2012 1:25:17 PM UTC-7, Sean S wrote:
>
> Can't seem to get the extern functionality to work, or I'm using it wrong. 
>  Basically I have two files:  One live and one test. The test file is built 
> with a separate build definition.  I want the test file to be able to see 
> the live file using the built in namespace functionality.
>
> This is the live project:
>
> { :id "live"
>   :source-path "src-cljs/live/"       
>   :compiler 
>     { :output-to "resources/public/js/*live*/main.js"
>       :optimizations :simple
>       :pretty-print true}} 
>
> I have the test configuration including the file created above:
>
>   { :id "test"
>     :source-path "src-cljs/test/"       
>     :compiler 
>       { :output-to  "resources/public/js/*test*/main.js"
>         :optimizations :simple
>         :externs ["resources/public/js/*live*/main.js"]  
>         :pretty-print true}}]}
>
>
> This is the namespace that I want to include for testing that is in the 
> live file resources/public/js/*live*/main.js: 
>
>   (ns helper.webTemplate ...)
>
> This is my attempt to include that namespace in the test file 
> resources/public/js/*test*/main.js:
>
>   (ns helper.webTemplate.test
>     (:require 
>       [helper.webTemplate           :as template]...)
>
>
> With error:
>
>     " required "helper.webTemplate" namespace not provided yet..."
>
> Is there a special (Or easier way) to use namespaces in local files?  I 
> could just have the test build move down a level since my folder structure 
> is:
>
> /src-cljs
>   /live
>   /test
>
> But would like to know if I can avoid that.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to