Fork me on GitHub
#perun
<
2016-10-30
>
bhagany04:10:24

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.

martinklepsch09:10:14

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

martinklepsch10:10:35

@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.

martinklepsch10:10:25

@bhagany alternatively you may try boot-livereload which @juhoteperi uses for his blog: https://github.com/Deraen/deraen.github.io/blob/blog/build.boot

bhagany15:10:23

@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.

martinklepsch15:10:49

@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

https://github.com/adzerk-oss/boot-cljs/wiki/Usage#multiple-builds — this has multiple builds in the heading but really it is recommended to just have a cljs.edn file

martinklepsch15:10:11

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.

martinklepsch15:10:54

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

martinklepsch15:10:54

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

bhagany15:10:12

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.

bhagany15:10:37

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

martinklepsch15:10:19

@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 😄

bhagany15:10:21

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

bhagany19:10:24

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.

bhagany19:10:49

the modern-cljs tutorials were very helpful as well. https://github.com/magomimmo/modern-cljs

bhagany19:10:15

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

bhagany19:10:58

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)

bhagany19:10:41

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

martinklepsch19:10:44

@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

martinklepsch19:10:56

Great to hear you've succeeded :)

bhagany19:10:31

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

martinklepsch19:10:25

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

martinklepsch19:10:30

You're welcome