Target lib.rs

I would like to wrap zola with extendr to make it available in R. However, to do this, we would need access to zola as a library. This has been discussed a few times before, like here. Would this be something the zola team is willing to support? Happy to offer a PR if so.

Since Zola is pretty modular, you can depend on various subcrates of it like this in your Cargo.toml:

[dependencies]
zola_site = { git = "https://github.com/getzola/zola", rev = "v0.20.0", package = "site" }
zola_utils = { git = "https://github.com/getzola/zola", rev = "v0.20.0", package = "utils" }

You check the full example here: Cargo.toml · 4608c7e710c0cdbc17f0dd08bde4582bcfea5d35 · bemyak / zola-new · GitLab

I am considering using Zola as the generator for a simple CMS UI that I am working on. The idea is to get something similar to Publii where everything is included in a single binary.

I would love to use zola as a lib as to offer live preview of changes and automatic building of the site before upload.

Right now, I’ve forked and made a branch that I use as a submodule and it works really well. I would really love “official” support for this if this fits your plans for Zola.

Zola is pretty much a library with a CLI frontend already. As for the fork, you probably want to write your version of that code? I doubt your backend would be ok with std::process::exit(1); in it and it’s pretty much standalone

Fair enough, re-implementing the serve myself would get rid of this potential issue with the exit.

At least, the little fork did well as a proof of concept.

Thanks for the quick answer.