Parameterize by domain

Hey folks!

I’m looking to serve the same phoenix application from two different domains. They have basically the same functionality, but the goal would be to use slightly different color schemes, and the will be a page or two in the router aimed at marketing that will be different.

I figure I can add a plug to the endpoint that looks at the domain and sets some assign that I use elsewhere to parameterize controllers and so forth, that seems fine. What I’m less clear on is what I would do for assets. We’re using Bulma for CSS. Anyone do something like this?

3 Likes

Set CSS variables in returned HTML body.

I’m also going to be serving multiple domains from 1 app. I didn’t get to thinking about or planning this aspect of the code base yet.

Are you able to predefine your bundles with webpack? Because then you could have a bundle for common code across all domains and then have a bundle for each individual domain and then have a link tag in your eex layout which could load a specific bundle based on the domain name?