Hi, I'm not new to Clojure but fairly new to web development so I feel a bit silly asking this because I'm trying to do something simple and can't figure it out. I went through the tutorial and set up my custom index.html page, at the bottom of which I want to load a script. But when I put it there, it loads the page right but I don't get the REPL. There must be something really basic that I'm not getting.
did you specify the -r
flag
I mean include it
I launched it with clojure -m figwheel.main --build cruel --repl
OK.. --repl
is the same as -r
It works fine as long as I don't include the script I'm trying to load, which is the KLIPSE plugin
I’m not familiar with klipse
. Sounds like it’s overwriting something it shouldn’t
the bottom of my file looks like this
<div id="app"></div>
<!-- this refers to target/public/cljs-out/main.js -->
<script src="cljs-out/cruel-main.js"></script>
<script src="<https://storage.googleapis.com/app.klipse.tech/plugin/js/klipse_plugin.js>"></script>
</body>
</html>
Klipse might override clojurescript because of how it works, unsure though
I’m guessing you’ll have to include klipse
as a dependency and use it in a more direct manner
I suppose that could be. There are instructions on how to host it locally, perhaps I'll try that.
or actually.. You could just give it a sandbox by including it in another html-file and use an iframe
kind of hacky though 🙂
ahh, ok
Thanks for the help. I thought I was doing something obviously wrong or something
Actually, the iframe idea works great!
I wanted to create a single javascript file for deployment in a specific directory, without affecting the dev build. So I created a live.cljs.edn
file (copied dev.cljs.edn) and added :output-to
with the new path
^{:watch-dirs ["test" "src"]
:css-dirs ["resources/public/css"]
:auto-testing true}
{:main practicalli-landing-page.core
:output-to "docs/cljs-out/main.js"}
I then created a new alias in the project.clj
file that calls this build
"fig:live" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "live"]
It all seems to work, just checking if I am doing this correctly, or if there is a recommended way.
For background, the project was created with Leiningen figwheel-main template and deployment is on GitHub pages along with a static index.html file. I use the /docs
folder to serve the static files from via GitHub pages.