jacobobryant / platypub

A publishing platform built with Biff
MIT License
65 stars 13 forks source link

Add file extensions to render-site and render-email scripts for IDE support? #65

Closed jeffp42ker closed 2 years ago

jeffp42ker commented 2 years ago

In Calva the breadcrumbs at the top of these scripts (supplied via clojure-lsp) are missing, making it more difficult to navigate the functions. I opened an issue in Calva which points up a client-server disconnect between Calva and clojure-lsp when there is no file extension. Relying on the shebang: "Yeah, adding to much complexity for a very rare use-case doesn’t sound like a good idea."

The lack of file extension makes it easy to switch a script to a bash implementation, I guess.

jacobobryant commented 2 years ago

My thinking on leaving off the extension is that from platypub core's perspective, the theme doesn't have to be written with babashka; it could be written with anything. so the executable render-site / render-email file provides a language-agnostic interface.

We could change those to a 1-line bash script that calls e.g. render-site.clj / render-site.bb (I'm not sure what the standard babashka extension is?) or whatever. Though realistically it'll be long time, if ever, before anyone tries to write a platypub theme in something other than babashka, so it also wouldn't hurt to just have the server call render-site.clj instead. for backwards compatibility maybe have the server look for both files and execute the first one it finds. I'd be happy to merge that if you wanted to put together a pr for that. should only be a few lines of code. I am planning to do a bit more work on platypub this weekend and I might get to it myself. And then we could change render-site to render-site.clj in the default theme.

I suppose we could also have the entrypoint be a config option on the site. Long-term, probably need to wait at least until after #21 is finished before it becomes clear exactly how themes should be structured.

jacobobryant commented 2 years ago

fyi with the latest release I ended up deleting the render-site / render-email scripts altogether; instead the theme config includes :render-site and :render-email options that specify the command to run. (platypub still checks for the original scripts for backwards compatibility). Also since the code is now structured like a regular clojure project rather than a couple one-off scripts, I used .clj for the extensions (that seems to also be what the babashka documentation does from what I've seen)