perun

Discuss perun static site generator
martinklepsch 2017-02-19T04:05:55.000523Z

@bhagany thanks for the pointer regarding task order, that fixes it 🙂

martinklepsch 2017-02-19T04:08:59.000524Z

One thing I’m about to try is rendering http://contentful.com data with Perun. @bhagany what do you regard as the best way to generate a bunch of files that don’t originate from individual other files? E.g. I’ll download a JSON blob and want to turn that into X html files.

bhagany 2017-02-19T04:20:51.000525Z

@martinklepsch ooo! I've been waiting for a use-case like this

bhagany 2017-02-19T04:22:11.000526Z

so, you'd like to do something like, make an API call, and render multiple pages based on the results?

martinklepsch 2017-02-19T04:22:24.000527Z

yep, pretty much

bhagany 2017-02-19T04:22:43.000528Z

okay, is it a defined set of pages?

martinklepsch 2017-02-19T04:23:25.000530Z

the number of pages is defined by the result of the API call (and thus may change) if that’s the question

bhagany 2017-02-19T04:23:38.000531Z

yes, that's what I was trying to say

bhagany 2017-02-19T04:23:42.000532Z

thinking...

martinklepsch 2017-02-19T04:24:45.000533Z

One way to do it would be to create “fake”/empty files in the fileset with the respective metadata I think

martinklepsch 2017-02-19T04:24:56.000534Z

Just wondering if there might be a better way

bhagany 2017-02-19T04:25:15.000535Z

yes, I think there is

bhagany 2017-02-19T04:25:34.000536Z

you could write a task that looks like this:

bhagany 2017-02-19T04:27:10.000537Z

(deftask contentful
  [r renderer RENDERER sym "page renderer (fully qualified symbol which resolves to a function)"]
  (render-task {:task-name "contentful"
                :paths-fn contentful-paths
                :renderer renderer
                :tracer :your.ns/contentful}))

martinklepsch 2017-02-19T04:27:43.000538Z

(I gotta move, will be back in 20min)

bhagany 2017-02-19T04:27:46.000539Z

np

bhagany 2017-02-19T04:28:56.000540Z

contentful-paths takes the fileset as an argument (which you can ignore), then you'd do your API call, and return a map shaped like {"path/to/render" render-args}

bhagany 2017-02-19T04:32:12.000543Z

oh, and render-task is io.perun/render-task

bhagany 2017-02-19T04:37:20.000545Z

heh, also, this is assuming you're running on Perun master. If you're on the most recent snapshot, then it's render-pre-wrap instead of render-task (this just changed today)

bhagany 2017-02-19T04:53:45.000548Z

I wasn't familiar with http://contentful.com before this, but it seems like it might be a decent candidate for official support in Perun, if there's interest. I'm not sure where the line on that kind of thing should be, though.

podviaznikov 2017-02-21T00:33:52.000573Z

bhagany: I think that having contentful task in either perun itself or as separate library are both good option. Maybe standalone library is better because there are a lot of services like contentful - https://headlesscms.org/. E.x. some time ago http://prismic.io was mentioned.

bhagany 2017-02-21T00:34:25.000576Z

Okay, that makes sense to me

martinklepsch 2017-02-19T05:00:53.000549Z

That looks like a nice solution!

martinklepsch 2017-02-19T05:00:59.000550Z

Will try in a bit

martinklepsch 2017-02-19T08:50:07.000551Z

I think something is wrong with that line. Causes the fileset to end up being a boolean: https://github.com/hashobject/perun/commit/392f4595c1efa0c13c90dcb38199cda541944032#diff-fcdbdc33f243f02eeb45eac4540c6427R291

martinklepsch 2017-02-19T09:30:47.000553Z

Cool! I now have a static perun site rendered with Rum/Enlive and a Rum app that picks up on the client

1
bhagany 2017-02-19T14:38:55.000554Z

of course you're right @martinklepsch. I don't know what I was thinking. Fixing shortly.

2017-02-19T14:53:43.000555Z

@martinklepsch @bhagany big +1 on integrating some http://contentful.com into perun. Have been thinking of this for a while - but haven’t come back around to it. Have used contentful extensively — it’s a great service.

bhagany 2017-02-19T14:54:00.000556Z

noted!

bhagany 2017-02-19T14:54:06.000557Z

thanks for the feedback

martinklepsch 2017-02-19T14:54:30.000558Z

It was pretty easy with the pointers @bhagany provided

2017-02-19T14:54:42.000560Z

:thumbsup:

2017-02-19T14:55:48.000561Z

@martinklepsch aside - are you doing any dev on http://status.im?

martinklepsch 2017-02-19T14:56:19.000562Z

@donmullen no, mostly lurking and thinking about applications (occasionally)

2017-02-19T14:56:30.000564Z

yeah - me too

2017-02-19T14:57:13.000565Z

fascinated by the possibilities of dapps / ethereum / blockchain tech

martinklepsch 2017-02-19T14:58:08.000566Z

I think I also am but also haven’t seen anything that had broader consumer adoption

martinklepsch 2017-02-19T15:03:24.000567Z

re contentful, json files et al. — it’s kind of what I had in mind with the last guide here: https://perun.io/guides/

bhagany 2017-02-19T15:09:30.000568Z

ah, yes. thanks for connecting those dots - I only had a vague idea about it

bhagany 2017-02-19T16:38:45.000570Z

@martinklepsch I'm interested in your static Rum/Enlive site. Is it live, or is the code public?

bhagany 2017-02-19T16:48:09.000571Z

hrm, I think something is going on with Runnable. I've been having tests time out or run out of memory (for a branch that changed very little) this morning. Now I just noticed that tests are being re-run for PR's that I haven't touched since yesterday. I haven't noticed this behavior before, is it normal, @podviaznikov?

bhagany 2017-02-19T20:04:21.000572Z

well, I managed to turn all the PR branches green on Runnable, though I think I broke the integration with github on #168, and I'm not sure how