perun

Discuss perun static site generator
bhagany 2016-10-30T04:19:24.000059Z

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.

martinklepsch 2016-10-30T09:45:14.000060Z

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

martinklepsch 2016-10-30T10:07:35.000061Z

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

martinklepsch 2016-10-30T10:10:25.000063Z

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

martinklepsch 2016-10-30T10:10:30.000065Z

https://github.com/Deraen/boot-livereload

bhagany 2016-10-30T15:48:23.000067Z

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

martinklepsch 2016-10-30T15:52:49.000068Z

@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

martinklepsch 2016-10-30T15:53:41.000069Z

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

martinklepsch 2016-10-30T15:54:11.000071Z

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.

martinklepsch 2016-10-30T15:54:54.000072Z

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

martinklepsch 2016-10-30T15:55:54.000073Z

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

martinklepsch 2016-10-30T15:55:55.000074Z

http://doohn2jgwdztw.cloudfront.net/

bhagany 2016-10-30T15:57:12.000075Z

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.

bhagany 2016-10-30T15:57:37.000076Z

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

martinklepsch 2016-10-30T15:58:19.000077Z

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

bhagany 2016-10-30T15:59:21.000078Z

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

bhagany 2016-10-30T19:35:35.000079Z

success!

bhagany 2016-10-30T19:37:24.000080Z

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.

bhagany 2016-10-30T19:37:49.000081Z

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

bhagany 2016-10-30T19:41:15.000083Z

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

bhagany 2016-10-30T19:43:58.000084Z

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)

bhagany 2016-10-30T19:44:41.000085Z

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

martinklepsch 2016-10-30T19:45:44.000086Z

@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

martinklepsch 2016-10-30T19:45:56.000087Z

Great to hear you've succeeded :)

bhagany 2016-10-30T19:47:31.000088Z

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

martinklepsch 2016-10-30T19:51:25.000089Z

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

martinklepsch 2016-10-30T19:51:30.000090Z

You're welcome