jondashkyle / nanopage

super handy utilities for traversing flat content state
Apache License 2.0
42 stars 4 forks source link

docs usage clarification #11

Closed sonn-gamm closed 6 years ago

sonn-gamm commented 6 years ago

(thought might be useful to put it here instead that pinging you on twitter)

could you compare nanopage to enoki to hypha?

say i am using choo.js, and want to build a website that i manage through a /content folder — which one should i use?

is it a matter of how much control of each single component you have? eg. enoki is more fully-fledged, whereas hypha (together w/ nanopage now?), lets you have more fine control over each function?

or can nanopage coupled with choo do everything anyway?

hope this can help to clarify the readme! appreciate your work.

jondashkyle commented 6 years ago

Definitely a good question, and I realize this can be a bit confusing as the boundaries between modules are still fluid. A quick overview of each module:

Choo is your little front-end framework. It makes it easy to keep what you see on the page and the data for your site in sync. It uses plugins/stores to structure that data.

Enoki (the module) provides content state. That’s it. If you use the module in Beaker where the Dat API is available, you can read the folder containing your content into state real time. In a traditional browser over HTTP that isn’t possible, so Enoki instead loads a fallback JSON file of what your content state looked like when last editing your content.

Hypha turns a folder of content into JSON. Enoki uses this to do just that. In Beaker it does that by passing the Dat Archive API as the filesystem (fs) module, and the Enoki CLI simply does a synchronous read and outputs that to content.json for HTTP fallback.

Nanopage is a super useful way of interacting with the content state that Hypha produces, but it can work with any JSON with this structure: { href: '/about', content: { } } . Think of it like a specialized Lodash library. So instead of using a bunch of array methods you can use plain english via utility methods like page('/about').files().first().value().

Each of these are standalone modules to enable you to progressively build a site. Want to simply turn some plain text into content state? Use smarkt.parse() and fs.readFileSync(). Want to turn a directory of content into state? Try hypha.readSiteSync().

This modularity also lets you easily leave the ecosystem, if you’d like to. Mafintosh has a good talk about this modular “UNIX philosophy” style development. So to answer your question; yes! Everything can be used with everything else.

sonn-gamm commented 6 years ago

Thank you for the detailed answer!