/embedded-hoplon-example

Example of attaching a Hoplon component to a mount point in an existing HTML page.

Primary LanguageClojure

embedded-hoplon-example

This project demonstrates attaching a Hoplon element to a div in a static HTML file.

assets/index.html is a static HTML file containing a div with the id mountpoint.

src/app/main.cljs.hl is a ClojureScript file processed by Hoplon. It contains an ns header instead of page, so the Hoplon compiler emits only ClojureScript, not HTML.

In src/app/main.cljs.hl, jQuery is used to find the div to mount to. Then, an instance of the counter component is attached to it.

A Hoplon project designed to...well, that part is up to you.

Dependencies

Usage

Development

  1. Start the dev task. In a terminal run:

    $ boot dev

    This will give you a Hoplon development setup with:

    • auto compilation on file changes
    • audible warning for compilation success or failures
    • auto reload the html page on changes
    • Clojurescript REPL
  2. Go to http://localhost:8000 in your browser.

  3. If you edit and save a file, the task will recompile the code and reload the browser to show the updated version.

Production

  1. Run the prod task. In a terminal run:

    $ boot prod
  2. The compiled files will be on the target/ directory. This will use advanced compilation and prerender the html.

License

Copyright © 2016, Your Name Goes Here