A Ruby gem for Rails 8.1
Fire a Rails app into a static site.
Kiln renders every GET route of a Rails app through Rack and writes plain files that any static host can serve. You keep routes, controllers, views, Turbo and Stimulus, and develop with bin/rails server.
Routes are the page list
Every GET route is a page. A route with params needs a param source, or the build names the line to add.
The build fails loudly
Render errors, missing assets, broken links and anchors are all reported at once, and the task exits non-zero.
Kiln knows nothing about your data
Models, repositories and Markdown stay ordinary app code. Kiln only sees the responses.
Three steps
Add the gem
# Gemfile
gem "kiln"
Declare the pages
# config/kiln.rb
Kiln.configure do |config|
config.url = "https://example.com"
end
Kiln.pages do
params :post, -> { Post.published.map { { slug: it.slug } } }
end
Build into dist/
RAILS_ENV=production bin/rails kiln:build
This site is a Rails app built with Kiln. Its source is in the docs folder of the repository.