retrogradeorbit / bootleg

Simple template processing command line tool to help build static websites
Eclipse Public License 2.0
256 stars 12 forks source link

🤔 How to build an entire site ? #watch-mode #routing #59

Open shivekkhurana opened 4 years ago

shivekkhurana commented 4 years ago

Hi @retrogradeorbit

Thanks for writing this package. I love the appeal of a small bash tool that spits html. It does what it claims to do really well.

However most sites I work on need more than ability to convert a template->html.

For example:

What's your goto way to solve these problems? Is it a part of bootleg philosophy or do you consider this as something external, maybe a set of babashka scripts.

Thank you

retrogradeorbit commented 4 years ago

Hi. Presently I'm doing this: https://github.com/epiccastle/epiccastle.io/blob/master/Makefile#L30-L35

But I have experienced some of the same pain. I have thought about making a watch mode, or some kinf of dependency building, but the ideas all spiral out of control as I follow them. I would like to keep bootleg small and to purpose. But also as a site grows, rebuilding everything continually becomes a real pain.

I certainly don't want to make a "framework", like the other static site generators. I like it very much as a tool. But how to make the tool solve this "when and what to rebuild" problem elegantly has so far alluded me.

I'm open to discuss any ideas.

borkdude commented 4 years ago

An option for file watching would be to add pod support:

https://github.com/babashka/babashka.pods

And then people can load a filewatcher pod:

https://github.com/borkdude/babashka/tree/master/examples/pods/pod-babashka-filewatcher

The above example has not been released as an official pod, but will be.

shivekkhurana commented 4 years ago

I quite like this idea of yours 💯

I certainly don't want to make a "framework", like the other static site generators. I like it very much as a tool.

My initial thought was to make a set of babashka scripts that handle the tasks mentioned above, but wanted to confirm if you have something built already.

If we plan to go in this direction, I quite like react-static's way of generating routes. I can create a POC and release it as a complimentary library.

The idea is to have a config that gives us all the files we need to watch, and probably a dependency graph. And then we (build) all child nodes when a parent is changed. Sounds simple, but don't know if it's easy.

@borkdude Thanks for pointing out the file watcher pod example. And thanks for building babashka 💛.

I have a noob question, since bootleg uses sci under the hood, is it possible to require bootleg source, or add it as a dependency?

Or do I need to install the bootleg and babashka binaries seperately, and use a shell to communicate?

borkdude commented 4 years ago

@shivekkhurana Bootleg could add pod support so it can be used as a pod in babashka.

retrogradeorbit commented 4 years ago

I will definitely be adding pod support #60

retrogradeorbit commented 4 years ago

The idea is to have a config that gives us all the files we need to watch, and probably a dependency graph.

That itself is quite a difficult problem. Or a lot of manual work. It's surprising how many dependencies a static site can have. And in how many places and how many formats it can be specified. You can have something referenced from a CSS file. And that file is referenced in a html template. That is bought into a bootleg .clj file... for example. This kind of complexity is something that might be attacked by bootleg or something else later.

I have a noob question, since bootleg uses sci under the hood, is it possible to require bootleg source, or add it as a dependency?

Pods will solve this problem and allow you to bring in bootleg functionality into babashka. I also plan on porting the require implementation over from spire for those only running bootleg.

shivekkhurana commented 4 years ago

That itself is quite a difficult problem. Or a lot of manual work. It's surprising how many dependencies a static site can have.

Component, Integrant and Mount are meant to handle scenarios like these. I'm wondering if this is the right use case for babashka. It makes sense to use the JVM.

Does startup time really matter in this case? Since watch mode is needed at dev time only. One downside I see to using the JVM is slow CI/CD.


Update: This repo popped up on my feed: https://github.com/OrgPad-com/volcano. It's handles site generation and watch mode but only with hiccup.

borkdude commented 4 years ago

Update: bootleg is now useable as a pod with babashka 0.0.98. Together with the filewatcher pod this could be an interesting setup.