[HN Gopher] Show HN: Shite - little hot-reloadin' static site ma...
___________________________________________________________________
Show HN: Shite - little hot-reloadin' static site maker from shell
Or more precisely, _my_ little site maker... It is a personal tool
that I thoroughly enjoyed making, and enjoy using to write my
website <https://evalapply.org>. A caveat before any more; nobody
was supposed to promote this insanity. Like, terrible things have
been done involving inotify and xdotool. _But_. It showed up on HN
some months ago. That too while it was still, shall we say,
fermenting. It got "done" some time thence, and _of course_ one
could not let the half-past just _be_. So here we are, for better
or worse. Thank you HN mods for helping me repost! _\\\// The
README explains all, animated GIFs and whatnot. Some assorted
highlights: - shite's, ah, "business logic" (except
templates) is about 300 lines of Bash, written in Functional
Programming style [^]. Pipeline all the things! - The innards
won't surprise Perl/PHP/Shell gentleperson hackers from the last
century. - The local hot reloading workflow is surprisingly
nice, and occasionally hilarious! No JavaScript needed. -
Full rebuilds are low performance and that's fine :) - Pandoc
is great. - Sometimes sed and regex is exactly the HTML
parser you need. *Very* sometimes. - stdio buffering can mess
you up - jq -Rr @html # escapes HTML; what?! ... and
all sorts of other stuff noted in the README and inline docs. [^]
because shell ain't a bad place to FP...
https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp...
--- P.S.The commit history stops at 3-odd months ago, because I've
been using a private fork for day-to-day content drafting,
publishing, and layout tweaks. The "business logic" is by and large
the same as the public version linked here.
Author : adityaathalye
Score : 109 points
Date : 2023-01-23 08:13 UTC (14 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| rlt wrote:
| Nitpick: Generally "hot reloading" refers to reloading a single
| module or component in the system, while retaining the rest of
| the page state.
|
| But maybe this counts because it's a static site.
| alexchantavy wrote:
| I really like the dreams and desires section and how it explains
| the philosophy and how you view the project
| yakshaving_jgt wrote:
| I'm assuming just about everyone is aware of the meaning of the
| word.
|
| https://www.urbandictionary.com/define.php?term=Shite
|
| Kind of depressing that people find this amusing.
| nmeofthestate wrote:
| I suggest a SFW rename to "connery"
| talideon wrote:
| You might want to look that up in French, but replace the 'y'
| with 'ie'...
| badcppdev wrote:
| It's sad because it's not hard to pick a name for a project
| that isn't a swear word.
| 082349872349872 wrote:
| I once had a gig someplace where the tradition was to name
| Hamming Distance 1 away from swear words. Best of both
| worlds?
| mrlonglong wrote:
| Oh do one mate quit griping and get with it!
| adityaathalye wrote:
| This remark prompted me to go rewatch (make sure you have
| headphones on)...
|
| this bit of fry and laurie
| https://www.youtube.com/watch?v=cVe3fTL1cPM
|
| this bit by atkinson and cleese
| https://www.youtube.com/watch?v=OGFz9gt0-Fc
|
| and this bit by atkinson alone
| https://www.youtube.com/watch?v=R7OxTxAvvLw
|
| made my day :)
| andrewmcwatters wrote:
| Hey Aditya, you can make your command a little more unix-y if you
| feel so compelled by just renaming `shite.sh' to `shite' and run
| the shell script as a utility since it's already `chmod +x`'d.
|
| Then you can `shite(1)` anywhere you want after you put the
| command in your PATH and feel like a proper `git(1)`.
|
| Good `shite(1)` mate. Love it.
| adityaathalye wrote:
| Sidelight: I tend to use _functions_ as Unix tools a lot more
| than scripts as Unix tools. No need for PATH twiddling, file
| ownership /permission setting, among other things. I wrote
| about it here: https://www.evalapply.org/posts/shell-aint-a-
| bad-place-to-fp...
| adityaathalye wrote:
| Thank you for the review! If only you knew of all the glorious
| plans :,)
|
| Apropos your note, may I direct you to "Unrealised Ambitions"
| in the README
| https://github.com/adityaathalye/shite#unrealised-ambitions
| appletrotter wrote:
| > Apropos your note, may I direct you to "Unrealised
| Ambitions" in the README
| https://github.com/adityaathalye/shite#unrealised-ambitions
|
| It doesn't have to be an unrealized ambition with a simple
| `mv` command ;)
| masukomi wrote:
| This is amazing and i love it.
|
| As much as I've been enjoying hugo, I've been craving something
| that's much closer to this.
| adityaathalye wrote:
| Haha thank you.
|
| I confess, I take childlike delight in every hotreload on save.
| Had it not worked well enough, I'd have stuck with hugo at the
| cost of a jankier authoring + build pipeline (org --ox-hugo-->
| markdown --hugo--> html).
| jamal-kumar wrote:
| This is really impressive, I tried making my own SSG in shell
| scripts after looking at all these bloated ways to do it and
| realizing "this is something I could literally do in ten minutes
| of bash". It works for my use case but you went WAY further with
| the concept, good stuff
| adityaathalye wrote:
| Thank you! It most assuredly was not "ten minutes of Bash".
|
| You see, there comes a time in every self-respecting Yak-
| shaving programmer's life when one is driven to render large-
| scale follicle trimmage unto a sizeable Yak. In my case, 'twas
| and 'tis the deceptively diminutive but in fact mighty Site-
| Maker-Yak that renders World Wide Web Sites publishable unto
| the Internet.
|
| I wager, engaging oneself in the glorious enterprise of Yak-
| shaving is at least as therapeutic for the trimmer as it must
| be to the trimmee. I wholeheartedly recommend it :)
| jamal-kumar wrote:
| Yeah the live reload is especially impressive, I was
| literally just slapping content in between a header and
| footer and getting away with easy clean results hahaha
| jrm4 wrote:
| Lol, funny, I dig it.
|
| Right here in real life I just do http://zim-wiki.org + a custom
| CSS Template + a few shell scripts.
|
| http://jrm4.com
| adityaathalye wrote:
| Thanks :)
|
| Likewise, I'm basically locked into "life in plaintext", as a
| die-hard orgmode user.
|
| With what I have on disk, a big positive is any "system" of
| organisation is opt-in, post-hoc, and fungible.
|
| Like, today, shite can be seen as merely one lens into a subset
| of my org files, to compile that subset into a website.
| Tomorrow I could bring back hugo.
|
| That choice has no bearing on how any other method of
| organisation might use those same files (e.g. I can pull up
| index views using orgmode's own query feature set).
|
| And further, a single blog posts's org file can power live
| demos in Emacs (org-babel), and gets exported as a blog post,
| and as a PDF slide deck, like this:
| https://www.evalapply.org/posts/why-and-how-i-use-org-mode/i...
| bashNoIGGERob wrote:
| [dead]
| 082349872349872 wrote:
| One thing I enjoy about shell pipelines is that intermediate
| processes may terminate them.
|
| eg https://www.99-bottles-of-beer.net/language-bourne-
| shell-108...
| adityaathalye wrote:
| In fact, I rely on that sort of early termination / circuit
| breaking as a feature!
|
| That is a big reason why I use functions. They help me define
| sane fallbacks, and/or enforce API contracts. Those, in turn,
| are points where I can enforce "fail and die" behaviour.
|
| Design notes: https://www.evalapply.org/posts/shell-aint-a-bad-
| place-to-fp...
|
| Example from shite: Hard stop if mandatory front matter for
| posts is absent:
| https://github.com/adityaathalye/shite/blob/master/bin/templ...
|
| edit: clarity
| 082349872349872 wrote:
| nice ... and the Heredocs are a nice way to template!
| adityaathalye wrote:
| Right?!
|
| It was a bit of a lightbulb moment. I wanted a way to just
| write HTML templates. What really sealed the deal was the
| ability to punch content from stdin anywhere within a
| heredoc's scope using `$(cat -)`:
| https://github.com/adityaathalye/shite#templating-system
| maw wrote:
| Serious(-ish) question: does "And last but not least, I hereby
| decree that all texsht herein be read in Sean Connery voish."
| mean that this technically isn't FOSS?
| m_mueller wrote:
| *FOSSH
| chubot wrote:
| Nice! I also use inotifywait for hot reload when writing
| https://www.oilshell.org/
|
| I never heard of the xdotool method ... although it sounds like
| it has some drawbacks?
| https://github.com/adityaathalye/shite/blob/master/bin/hotre...
|
| I do it with a crappy Python web server that dynamically inserts
| some JavaScript. This also has bugs and drawbacks, though I don't
| think any fundamental ones ... At some point I would like to
| "make it nice", but it has been working well in practice for
| years
|
| I think the method is reasonable, and doesn't depend on your
| local desktop environment as much.
|
| I also have a Makefile for incremental rebuilds, but I would
| really like to replace that with Ninja. Ninja goes pretty well
| with shell (although it also has the issue of needing to escape $
| as $$)
| datpiff wrote:
| A+ name, no notes
| [deleted]
| adityaathalye wrote:
| Heh, thank you. It almost wrote itself.
|
| I was trying to cook up a clever tagline, and fell upon "static
| sites from shell" and my brain looped about and found the
| tongue twister, sort of like "She sells sea shells on the sea
| shore", and well all esh shounds shtarted shounding like thish.
|
| These days I like that name more because it (hopefully) alerts
| the Dear Reader about the quality of software they are about to
| visit, should they take it upon themselves to do so.
| dboreham wrote:
| Y'all know that's a word in Scottish English, right?
| jwdunne wrote:
| Northern English dialect too...
| raffraffraff wrote:
| And Irish
| walthamstow wrote:
| London too
| adityaathalye wrote:
| A Bit of Fry and Laurie, Concerning Language
| https://www.youtube.com/watch?v=3MWpHQQ-wQg
| mrlonglong wrote:
| And southern too. All shite.
| satvikpendem wrote:
| I'm pretty sure that's the joke.
___________________________________________________________________
(page generated 2023-01-23 23:01 UTC)