Parklife is a Ruby library to render a Rack app (Rails/Sinatra/etc) to a static site so it can be served by Netlify, Now, GitHub Pages, S3, or another

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2025-01-06 08:30:04

Parklife is a Ruby library to render a Rack app (Rails/Sinatra/etc) to a static site so it can be served by Netlify, Now, GitHub Pages, S3, or another static server.

Now generate a Parkfile configuration file and build script. Include some Rails- or Sinatra-specific settings by passing --rails or --sinatra, create a GitHub Actions workflow to generate your Parklife build and push it to GitHub Pages by passing --github-pages.

Parklife is configured with a file called Parkfile in the root of your project, here's an example Parkfile for an imaginary Rails app:

Now you can run parklife build which will fetch all the routes and save them to the build directory ready to be served as a static site. Inspecting the build directory might look like this:

Parklife doesn't know about assets (images, CSS, etc) so you likely also need to generate those and copy them to the build directory, see the Rails example's full build script for how you might do this.

Sometimes you need to point to a link's full URL - maybe for a feed or a social tag URL. You can tell Parklife to make its mock requests with a particular protocol / host by setting its base so Rails *_url helpers will point to the correct host:

Leave a Comment