Last active
August 29, 2015 14:08
-
-
Save asimjalis/65a8149d8297e3cfdb50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build and run then open browser to http://localhost:9000/hello.html. | |
# Then open browser console. It has an error message like this: | |
# Uncaught TypeError: Cannot read property 'Jf' of undefined hello.js:6587 | |
# Also the REPL hangs. | |
# If I replace :advanced with :whitespace in project.clj then the browser | |
# console reports no errors. Also the REPL works fine. | |
# Make test directory. | |
mkdir -p $HOME/tmp/cljs-test | |
cd -p $HOME/tmp/cljs-test | |
# ./src-cljs | |
mkdir ./src-cljs | |
# hello.cljs | |
cat << 'END' > src-cljs/hello.cljs | |
(ns hello | |
(:require [clojure.browser.repl :as repl])) | |
(defn ^:export main [] | |
"hello") | |
(repl/connect "http://localhost:9000/repl") | |
END | |
# hello.html | |
cat << 'END' > hello.html | |
<html> | |
<head> | |
<title>Cluster Splitter</title> | |
</head> | |
<body> | |
<script type="text/javascript" src="hello.js"></script> | |
</body> | |
</html> | |
END | |
# project.cljs | |
cat << 'END' > project.clj | |
(defproject cluster_splitter "1.1.0-SNAPSHOT" | |
:description "Hello." | |
:dependencies [ | |
[org.clojure/clojure "1.6.0"] | |
[org.clojure/clojurescript "0.0-2371"]] | |
:plugins [ | |
[lein-cljsbuild "1.0.3"]] | |
:cljsbuild { | |
:builds [ | |
{:source-paths ["src-cljs"] | |
:compiler {:output-to "hello.js" | |
:optimizations :advanced | |
:pretty-print true}}]}) | |
END | |
# build_and_run.sh | |
cat 'END' > build_and_run.sh | |
rm -rf out repl target hello.js | |
lein cljsbuild once | |
rlwrap lein trampoline cljsbuild repl-listen | |
echo start browser pointing to http://localhost:9000/hello.html | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment