Fork me on GitHub
#figwheel-main
<
2019-05-23
>
Bobbi Towers08:05:31

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.

hkjels08:05:51

did you specify the -r flag

hkjels08:05:42

I mean include it

Bobbi Towers08:05:01

I launched it with clojure -m figwheel.main --build cruel --repl

hkjels08:05:27

OK.. --repl is the same as -r

Bobbi Towers08:05:10

It works fine as long as I don't include the script I'm trying to load, which is the KLIPSE plugin

hkjels08:05:55

I’m not familiar with klipse. Sounds like it’s overwriting something it shouldn’t

Bobbi Towers08:05:44

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=""></script>
  </body>
</html>

dominicm08:05:02

Klipse might override clojurescript because of how it works, unsure though

hkjels08:05:17

I’m guessing you’ll have to include klipse as a dependency and use it in a more direct manner

Bobbi Towers08:05:06

I suppose that could be. There are instructions on how to host it locally, perhaps I'll try that.

hkjels08:05:23

or actually.. You could just give it a sandbox by including it in another html-file and use an iframe

hkjels08:05:31

kind of hacky though 🙂

Bobbi Towers08:05:59

Thanks for the help. I thought I was doing something obviously wrong or something

Bobbi Towers09:05:57

Actually, the iframe idea works great!

👍 4
practicalli-johnny17:05:12

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.