I'm working on getting server rendering running with Nashorn. I've been 
successful with :optimization :simple, following 
https://github.com/DomKM/omelette (i stripped out the minimal server rendering 
example here https://github.com/pleasetrythisathome/om-server-rendering.

I'm trying to evaluate the require dependencies/files in Nashorn so that I can 
then call an arbitrary function within a namespace (in this case, 
render-to-string).

Mike Thompson's example of :optimization :none testing was helpful 
(specifically his PhantomJs runner file 
https://github.com/mike-thompson-day8/cljsbuild-none-test-seed/blob/master/test/bin/runner-none.js),
 but  since he's using PhantomJs rather than Nashorn I'm a little stuck on my 
issue.

(let [js (doto (.getEngineByName (ScriptEngineManager.) "nashorn")
             (.eval (-> "public/out/goog/base.js"
                        io/resource
                        io/reader))
             (.eval (-> "public/out/goog/deps.js"
                        io/resource
                        io/reader))
             ;; React requires either "window" or "global" to be defined.
             (.eval "var global = this;")
             ;; parse the compiled js file
             (.eval (-> "public/main.js"
                        io/resource
                        io/reader))
             (.eval "for(var namespace in goog.dependencies_.nameToPath) 
goog.require(namespace);")
             )
        core (.eval js "main.core")])

errors saying that "main" is not defined.

replacing the goog.require line with a simpler "goog.require("\main.core\")" 
produces the same error

any thoughts?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to