0

I want to serve static HTML pages using nginx. Then, I will use jQuery to update DIVs, SPANs, etc via AJAX calls from a Padrino server.

I like creating my web pages in HAML because it's easier but in production, I don't want to serve HAML templates. Just raw, HTML at the speed of nginx.

Is there an easy way to do this?

What would be ideal would be a service that automatically renders HAML, partials, etc into the public folder that nginx could serve.

Nakilon
  • 34,866
  • 14
  • 107
  • 142
cbmeeks
  • 11,248
  • 22
  • 85
  • 136

2 Answers2

2

Simple,

add padrino-cache to your app

class SimpleApp < Padrino::Application
  register Padrino::Cache
  enable :caching

  get '/foo', :cache => true do
   expires_in 30 # expire cached version at least every 30 seconds
   'Hello world'
  end
end

Then save wherever you want to serve it:

set :cache, Padrino::Cache::Store::File.new(Padrino.root('public'))

You can read more here: http://www.padrinorb.com/guides/padrino-cache

DAddYE
  • 1,719
  • 11
  • 16
1

First thing that pops to my mind would be Jekyll. Anyway I see it only as a matter or optimization, so if you already have a Sinatra, you could start by rendering HAML on every request, and than add caching.

Slartibartfast
  • 8,735
  • 6
  • 41
  • 45