I'm working through Closure tutorials translating them to ClojureScript. Unfortunately, I've hit a problem where the code works with {:optimizations :simple} but fails with {:optimizations :advanced}.
The code is very simple. It basically is a trivial template example with Soy (from Closure templates). Here's example/core.cljs: (ns example.core (:require [goog.dom :as dom] [goog.date :as date] [soy :as soy] [example.templates :as tmpls])) (defn map-to-obj [m] (.strobj (reduce (fn [m [k v]] (assoc m k v)) {} (map #(vector (name %1) %2) (keys m) (vals m))))) (defn ^:export say-hello [message] (let [hello (dom/getElement "hello")] (dom/setTextContent hello message))) (defn ^:export say-hello2 [message] (let [hello (dom/getElement "hello") data {:greeting message :year (. (date/Date.) (getFullYear))}] (soy/renderElement hello tmpls/welcome (map-to-obj data)))) And the template hello.soy: {namespace example.templates} /** * @param greeting * @param year */ {template .welcome} <h1 id="greeting">{$greeting}</h1> The year is {$year}. {/template} The template is compiled to hello.soy.js. I pass in the path to hello.soy.js as well as closure-templates/javascript during compile. The HTML: <!DOCTYPE html> <html> <head> <title>Example: Hello World</title> </head> <body> <div id="hello"></div> <script src="hello-cljs.js"></script> <script> example.core.say_hello2("Hello World!"); </script> </body> </html> With simple optimizations, this produces the expected output. With advanced optimizations both fields of the template are undefined. I'm probably doing something silly. Any ideas? jack. -- 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