figwheel-main

figwheel-main http://figwheel.org
porkostomus 2019-05-23T08:09:31.006900Z

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.

2019-05-23T08:12:51.007200Z

did you specify the -r flag

2019-05-23T08:13:42.007600Z

I mean include it

porkostomus 2019-05-23T08:14:01.008Z

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

2019-05-23T08:14:27.008500Z

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

porkostomus 2019-05-23T08:15:10.009400Z

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

2019-05-23T08:17:55.010300Z

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

porkostomus 2019-05-23T08:21:44.011600Z

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>
    &lt;script src="<https://storage.googleapis.com/app.klipse.tech/plugin/js/klipse_plugin.js>"&gt;&lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;

dominicm 2019-05-23T08:29:02.012700Z

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

2019-05-23T08:29:17.013Z

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

porkostomus 2019-05-23T08:31:06.014400Z

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

2019-05-23T08:31:23.014700Z

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

2019-05-23T08:31:31.015Z

kind of hacky though 🙂

2019-05-23T08:31:45.015200Z

ahh, ok

porkostomus 2019-05-23T08:33:59.016100Z

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

porkostomus 2019-05-23T09:39:57.018200Z

Actually, the iframe idea works great!

👍 1
practicalli-john 2019-05-23T17:26:12.025900Z

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.