CamelCamelCamel
CamelCamelCamel

Reputation: 5200

Using HAML for static pages in Ruby on Rails

I want to create a static page, one that will be served by Nginx instead of rails. I want to write it in HAML. Is there a way to use the assets pipeline for this, instead of adding a line to my build file?

Upvotes: 0

Views: 685

Answers (3)

Todd A. Jacobs
Todd A. Jacobs

Reputation: 84343

I think the problem here is that something needs to kick off your conversion. Whether you're using HAML, sprockets, jekyll, or something else isn't the point; a monitoring or periodic process of some kind is still required to start the conversion process.

You may want to use guard, autotest, cron, inotify, or any of a host of other tools to kick off your conversion script whenever the contents of your HAML file change. Personally, I think cron is the simplest option, but an inotify callback may be the most resource-efficient choice. Your mileage may vary.

Upvotes: 1

ksol
ksol

Reputation: 12235

If it's a static page, then make sure your page can be cached by the browser or the server. That does not exactly answer your question, but serves the same goal I guess.

Upvotes: 1

Hauleth
Hauleth

Reputation: 23556

You can just compile your Haml file to HTML file using haml command:

haml -qf html5 [infile] [outfile]

And then you can serve it without Rails.

Upvotes: 1

Related Questions