Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

facjure/replify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replify

A fast Clojure/Cljs REPL and a minimalist build tool with zero configuration, as a standalone uberjar.

Rationale

Why learn another build tool when you can code on the REPL with zero configuration?

The node-based, blazing fast (~10x) Browser, Rhino, Nashorn, and Node repls are bundled in Clojurescript. This library exposes these build tasks as plain old functions on the repl. In addition it maintains compatibility with leiningen project maps, and provides utilties to manage runtime classpath and dynamic dependencies using alembic.

Quickstart

Assuming you installed Java8, rlwrap (optional), and downloaded replify.jar, start a REPL:

rlwrap java -jar replify.jar
user=> (use 'replify.core)

On an Intel i7-7500U CPU @ 2.70GHz and 32GB Ram, with Ubuntu 17, this repl launches instantly. From here you can perform common Cljs tasks.

For lightweight scipts under 'src' add the classpath, like this:

rlwrap java -cp 'replify.jar:src' clojure.main

Tasks

All tasks assume your current cljs/cljc source files are under src.

user=> (use 'replify.core)
user=> (build 'foobar.core)
user=> (build-on-node 'foobar.core)
... node main.js
user=> (start-node-repl)
user=> (start-rhino-repl)
user=> (start-brepl)
user=> (release 'hello.core)

For browser REPLs: Create an index.html at the project root and include (:require [replify.core :as repl]) in your main source file.

<html>
	<body>
      <script src="target/app.js" type="text/javascript"></script>
      <div id="app"> </div>
    </body>
</html>

Refresh browser at localhost:9000 for brepl to connect.

To manage dependencies, create a project.clj in the current directory. Replify wraps leiningen but you don't have to install it.

(defproject FIXME "0.1.0"
    :description "FIXME"
    :url "https://github.com/FIXME"
    :dependencies [[org.clojure/clojure "1.7.0"]
                   [org.clojure/clojurescript "1.7.28"]]
    :jvm-opts ^:replace ["-Xmx512m" "-server"]
    :node-dependencies [[source-map-support "0.3.1"]]
    :plugins [[lein-npm "0.5.0"]]
    :source-paths ["src" "target/classes"]
    :clean-targets ["out" "release"]
    :profiles {:dev {:dependencies [[facjure/replify "0.3.0"]]}}
    :target-path "target")

Add dynamic dependencies

=> (add-deps '[org.omcljs/om "0.9.0"])
=> (add-deps '[[org.omcljs/om "0.9.0"] [sablono "0.3.4"] [facjure/mesh "0.3.0"]])
=> (load-cljsjs-deps) ;; load all available cljsjs deps into classpath

With Figwheel/Boot?

Replify is aimed at prototyping on the CLI and your favorite editor, with zero dependencies and configuration.

For projects with 'complex' build tasks and configuration use Figwheel, Boot, or even Lumo on Node.

Credits

Clojurescript Wiki.

Status

Clojars Project

License

Copyright © 2015 - 2017 Facjure, LLC.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.