There is nothing *exactly* like this for clojurescript. The problem is 
clojurescript compiler is implemented in Clojure and thus requires a JVM to 
compile the code. Brython's compiler is implemented in js so it can run in 
the browser.

There was a cljs-in-cljs (self-hosted clojurescript) compiler project but 
it's not under active development: http://clojurescript.net
It works, but its nearly a year behind clojurescript mainline. It's 
organized about repl usage (like the website), but with some glue code I'm 
sure it could read script tags instead.

An alternative is to have a clojurescript compiler service and submit the 
content of script tags to it for compilation and evaluate the returned js 
in the browser. This is basically how http://cljsfiddle.net/ works.

Another idea is to run the clojurescript compiler in an applet. (I'm pretty 
sure no one has tried this.)

On Tuesday, October 28, 2014 11:12:04 AM UTC-5, Asim Jalis wrote:
>
> Is it possible to embed Clojure in HTML using the approach used in Brython 
> for Python?
>
> https://news.ycombinator.com/item?id=4923530
>
> Here is the correct link to the site: http://www.brython.info/
>
> The idea is to embed Python code in the HTML and then have an interpreter 
> that translates it to JavaScript on the fly. Here is what it looks like.
>
> <script type="text/javascript" src="brython.js"></script>
> <script type="text/python">
> from browser import document as doc
> from browser import alert
> def echo(*args):
>   alert("Hello %s !" %doc["zone"].value)
> doc["test"].bind("click", echo)
> </script>
> <p>Your name is : <input id="zone"><button id="test">clic !</button>
>
> From an efficiency point of view this is not as optimal as the 
> compiler-based approach that ClojureScript uses—however, from the 
> perspective of lower-the-barrier-to-entry this approach wins hands down. It 
> is great for writing quick one-off scripts that over time can evolve into 
> more sophisticated applications.
>
> Asim
>

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to