I found the cause after looking at google closure more closely. The
following is wrong:
goog.require('goog.ui');
It must be:
goog.require('goog.ui.Button');
So the correct clojurescript code is:
(ns test
(:import goog.ui.Button))
(.render (new Button "Hello!") (goog.dom/getElement "b1"))
Razvan
luni, 15 aprilie 2013, 21:13:19 UTC+3, Răzvan Rotaru a scris:
>
> Hi,
>
> I am currently unable to get to the bottom of a "undefined nameToPath"
> error in clojurescript. Here's the script:
>
> *test.cljs:*
> (ns test
> (:require [goog.dom :as gdom] [goog.ui :as gui]))
>
> (.render (new gui/Button "Hello!") (gdom/getElement "b1"))
>
> And the compiled output:
>
> *test.js (compiled) :*
> goog.provide('test');
> goog.require('cljs.core');
> goog.require('goog.ui');
> goog.require('goog.dom');
> (new goog.ui.Button("Hello!")).render(goog.dom.getElement("b1"));
>
>
> *bootstrap.js (compiled) :*
> goog.addDependency("base.js", ['goog'], []);
> goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string',
> 'goog.array', 'goog.object', 'goog.string.format',
> 'goog.string.StringBuffer']);
> goog.addDependency("../test.js", ['test'], ['cljs.core', 'goog.dom',
> 'goog.ui']);
>
> *index.html:*
> <!DOCTYPE HTML>
> <html>
> <head>
> <meta charset="UTF-8">
> <title>Habarnam</title>
> </head>
> <body>
> <div id="b1"></div>
> <script type="text/javascript" src="goog/base.js"></script>
> <script type="text/javascript" src="bootstrap.js"></script>
> <script>
> goog.require('test');
> </script>
> </body>
> </html>
>
> Any ideas what i'm doing wrong here? Thanks.
>
> Răzvan
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.