Best way to customize CSS for tenants in a multi-tenant application?

I use the pearl of an apartment to create an application with several tenants (each tenant lives in a different Postgres scheme).

What is the best way in Rails to define custom CSS overrides for each tenant?

+5
source share
1 answer

Given that multi-user in itself is a deviation from the way things are done, I'm not sure that the final answer will be determined here.

I recommend the following approach, which I think is well-suited for your use:

In your layout:

<html> <head> <%= stylesheet_link_tag "tenant_#{@tenant_name}" %> </head> <body class="tenant-<%= @tenant_name %>"> </body> </html> 

In your scss files:

For each tenant (for example, t1) you can:

tenant_t1.css.scss

 body.tenant-t1 { ... stylesheets specific to tenant 1 scoped within tenant-specific class ... } 
0
source

All Articles