Tips for providing multiple layouts in a multisite environment (aka the SaaS holy grail)

One of the apps I’m working on is a SaaS solution for an online
product catalog. Every catalog has it’s own domain and can be accessed
as if it’s a site on its own (www.client_a.com and www.client_b.com
are both served by the same Rails app).

Now building this app all works well, but I’m having some troubles
thinking of a good solution for the templating system. Since these
online catalogs are extending already existing websites of our clients
it is needless to say that the templating system should be highly
customizable.

There are a few solutions I have tried (and a few I’ve not), I’ll
share those with you and I’m interested with your solutions to this
kind of problem.

  1. Use the same erb templates for all catalogs, returning the same
    HTML structure for every catalog, but using a custom stylesheet per
    catalog. So turning the stylesheet plus images into metadata.
    Pro: easy to implement.
    Con: CSS is very limited to customize a layout.
    Con: The designer guy now hates me.
    Con: The CSS/images aren’t in the same git repository, and you need to
    use something like FTP to update them.

  2. Also turn everything under app/views into metadata.
    Pro: The sky is the limit
    Con: Hard to implement.
    Con: Hard to maintain.
    Con: You don’t have custom controllers/actions (or models) for
    seperate pages and logic.
    Con: You quickly resort to ugly hacks because of the above reasons
    Con: Do I also need custom helpers per catelog? Are helpers metadata?
    Con: Templates are edited on a remote machine.

  3. Use a different partial per html snippet per catalog.
    (haven’t tried this yet)

  4. Some kind of templating engine?

Any other ideas?

Recognizing the subdomain and doing the routing is really the easiest
thing of a SaaS solution. But when you want to provide ‘homepages’ to
clients through a SaaS solution, it’s a lot tougher!