Nyth 🪺
Pronounced neeth (Welsh for "nest")
Nyth is a tiny Rack renderer for file-backed ERB pages and partials. No structure, just build it: put files in app, put Ruby in lib, refresh the page.
Usage
run Nyth.app(root: __dir__, reload: :changed, reload_check_interval: 5.0)Requests map directly to files in app:
-
/rendersapp/index.erb. -
/about.erbrendersapp/about.erb. -
/assets/style.cssservesapp/assets/style.css.
ERB files can render partials from app:
<%= render "_nav.erb" %>
<%= render "_page_title.erb", heading: "About" %>Files beginning with _ are render-only partials and return 404 when requested directly.
Ruby constants under lib are loaded with Zeitwerk. By default, reload: :changed checks Ruby file mtimes under lib at most once every 5 seconds and reloads constants only after a file changes. The nest stays warm without rebuilding it on every request.
Reload modes:
-
:changedreloadslibonly when Ruby files change. -
:alwaysreloadslibon every request. -
falseloadslibonce at boot.
Set reload_check_interval: to control how often :changed scans lib.
Tests
bundle exec rake