Skip to content

johnm/hoplon

 
 

Repository files navigation

Stories in Ready epicycles

Hoplon

Hoplon is a set of tools and libraries for making web applications. Hoplon provides a compiler for web application frontend development, and includes the following libraries as dependencies to complete the stack:

  • Javelin: a spreadsheet-like dataflow library for managing client state. Hoplon tightly integrates with Javelin to reactively bind DOM elements to the underlying Javelin cell graph.
  • Castra: a full-featured RPC library for Clojure and ClojureScript, providing the serverside environment.
  • Cljson: an efficient method for transferring Clojure/ClojureScript data between client and server. Castra uses cljson as the underlying transport protocol.

Example

<script type="text/hoplon">
  ;; Page declaration specifies output file path.
  (page "index.html")
  
  ;; definitions are optional
  (defn my-list [& items]
    (div
      :class "my-list"
      (apply ul (map #(li (div :class "my-list-item" %)) items))))

  (def clicks (cell 0))
</script>
    
<html>
  <head>
    <title>example page</title>
  </head>
  <body>
    <h1>Hello, Hoplon</h1>
    
    <!-- an HTML syntax call to the my-list function -->
    <my-list>
      <span>first thing</span>
      <span>second thing</span>
    </my-list>

    <!-- using FRP to link DOM and Javelin cells -->
    <p><text>You've clicked ~{clicks} times, so far.</text></p>
    <button on-click="{{ #(swap! clicks inc) }}">click me</button>
  </body>
</html>

Or, equivalently:

(page "index.html")

(defn my-list [& items]
  (div
    :class "my-list"
    (apply ul (map #(li (div :class "my-list-item" %)) items))))

(def clicks (cell 0))

(html
  (head
    (title "example page"))
  (body
    (h1 "Hello, Hoplon")

    (my-list
      (span "first thing")
      (span "second thing"))

    (p (text "You've clicked ~{clicks} times, so far."))
    (button :on-click #(swap! clicks inc) "click me")))

Documentation

Demos

Dependency

Artifacts are published on Clojars.

latest version

License

Copyright (c) Alan Dipert and Micha Niskin. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse
Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
be found in the file epl-v10.html at the root of this distribution. By using
this software in any fashion, you are agreeing to be bound by the terms of
this license. You must not remove this notice, or any other, from this software.

About

Hoplon web development tools and libraries.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 99.5%
  • Shell 0.5%