Fork me on GitHub

I’m playing around with perun as a way to get more comfortable with boot (so, 2-alarm noob alert), but I am having a heck of a time moving past the getting started wiki. I can render to disk, and I can serve without writing to disk, and I’ve been trying to get some sort of autoreload working. I’ve tried boot-reload, because I’ll eventually have some cljs to reload as well, but for now I’d just like to reload html. I gather that something javascripty needs to happen, but I’m not including any scripts in the page I’m rendering, so I clearly have a disconnect somewhere around there. Any help or links to things I should read would be very welcome.


@bhagany: cool you're giving Perun a spin, it's definitely very rough around the edges but We're happy to help


@bhagany if you are going to have some CLJS anyways, just add a cljs build + reload. When HTML files change boot-reload will initiate a hard reload.


@bhagany alternatively you may try boot-livereload which @juhoteperi uses for his blog:


@martinklepsch thanks! some judicious use of (target) has helped me diagnose one of my issues - something is up with my output paths. Right now I think it’s that the default output dirs of (render) and (cljs) are different, and as a result my (serve) task can’t see the reload js. I’ll report back on how fixing that goes.


@bhagany yeah so the perun tasks mostly output to public/ when using the cljs task make sure you have a .cljs.edn file somewhere in there so the compiled JS can be served

martinklepsch15:10:41 — this has multiple builds in the heading but really it is recommended to just have a cljs.edn file


Boot-cljs will create one if there is none but you will want to understand why these files are there and how they can influence the build.


as an example these files are modified by the reload task — extra code is injected into the build.


@bhagany I also started working on a better website for perun but it's still pretty much WIP besides one getting started guide


okay, I didn’t quite understand the .cljs.edn on my first read-through, I’ll give it another go. My first impulse was to go the other way, and change perun’s output dir, rather than cljs’s. I’ll follow your recommendation instead.


and I’ll give your new site a look too, thanks 🙂


@bhagany admittedly the documentation around .cljs.edn sucks and should be improved (for a long time) but so far we've spent time talking it through with people and explaining which is probably not the most sustainable approach 😄


hahaha, probably true, but I definitely understand. documentation is hard, and goes out of date easily.


one of the main pieces I was missing was where I should be putting the .cljs.edn file. Once I got that, and also once I understood how boot-cljs sets :output-to, it all came together.


the modern-cljs tutorials were very helpful as well.


oh, and also, understanding what you meant by “extra code is injected into the build” by boot-reload, and how that’s accomplished


in case any silent noobs are following along - .cljs.edn files go in whatever you’ve defined as your :resource-paths in build.boot. :output-to is set to the directory the .cljs.edn file is in, relative to your resource path, with the extension replaced with .js (ie: js/main.cljs.edn -> js/main.js)


boot-reload modifies the .cljs.edn file to include a require that handles the websocket connection and reloading.


@bhagany: if you feel like writing this up in the boot-cljs wiki you'd be most welcome but I also took a note to do that earlier


Great to hear you've succeeded :)


I’m not sure I’m confident enough yet to write documentation, but I’ll be trying to get to that point. Thanks so much for your help


I figured, no pressure, just an invitation :) happy to review in any case


You're welcome