Hoplon 介绍
Hoplon 是 Web 编程更简单的方式,该项目包含 Web 编程的一些方法和库。采用
Clojure 和 ClojureScript 编写应用。
ClojureScript 代码示例:
(page "foo/bar.html" (:require [my.lib :as lib]))(defc clicks 0)(html (head (title "Hello World") (link :rel "stylesheet" :href "css/main.css")) (body (lib/heading-large "Hello, world!") (p (text "You've clicked ~{clicks} times.")) (button :on-click #(swap! clicks inc) "Click me!")))
对应的 HTML 代码:
<script type="text/Hoplon"> (page "foo/bar.html" (:require [my.lib :as lib])) (defc clicks 0)</script><html> <head> <title>Hello World</title> <link rel="stylesheet" href="css/main.css"> </head> <body> <lib.heading-large>Hello, world!</lib.heading-large> <p><text>You've clicked ~{clicks} times.</text></p> <button on-click="{{ #(swap! clicks inc) }}"> Click me! </button> </body></html>
Hoplon 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。