Kevin Whitaker
Kevin Whitaker

Reputation: 13425

Sinatra: Compile haml files (with partials) into HTML versions?

I've built a site in Sinatra, and need to "compile" it into HTML so I can hand it off to the client (their site can't run Sinatra. Miscommunication on my part). Right now I'm just hitting the site locally and saving the source from my browser. Is there a command I can run, or a rake task I can write to just dump the compiled files to a folder?

Thanks!

Upvotes: 1

Views: 214

Answers (2)

Denis de Bernardy
Denis de Bernardy

Reputation: 78463

Take a look into Middleman:

http://middlemanapp.com

It is a static site generator based on Sinatra. It probably won't be much work to edit your existing site to make use of it, allowing to keep the Sinatra-based site on your end for development purpose, while allowing you to publish the static version for your customer.

Upvotes: 1

Arman H
Arman H

Reputation: 5618

Not really a Ruby solution, but if you have wget, this will mirror the entire site, save all of the pages, re-create the directory structure from URLs, download the assets (images, css, js, etc) and rewrite their paths to be relative to HTML pages (suitable for local viewing):

$ wget --verbose --mirror --page-requisites --convert-links \
  --no-cache --adjust-extension --force-directories \
  http://localhost:4567

Upvotes: 2

Related Questions