1

I have multiple segmented Rails apps that are connected to each other:

  • App A
  • App B
  • App C

While I try to keep the design, such as header and footer, to look similar, but each app has its own stylesheet, javascript and images in the asset folder. Some of these assets are duplicate, like CSS for footer. It makes maintenance difficult.

I'm wondering if I could do something like having App D, where App A, B, and C will just retrieve the assets from App D. So if I need to change anything, I can just change the assets in App D.

How do I achieve this?

1 Answer 1

3

There is not much detail in the question but that gives some flexibility in the answers. These would work for almost any web app, not just Rails.

You could store the duplicate items in a git submodule.

Or you could write a script that copies the assets to each app each time you update them.

Or (if the apps are on the same filesystem) you could hard link or symbolically link all the asset files together.

Or you could could link the assets with the full urls (including the domain names) so that the browser always gets them from the same server (in much the same way as the browser might get jQuery from the Google Content Delivery Network.)

2
  • @ experienced answerers: would these be better posted as 4 separate answers, so users could vote up the better ones, or with 4 options combined in one answer, as I have here?
    – dcorking
    Commented Aug 1, 2014 at 19:21
  • 1
    I think what you did is fine. Posting 4 separate answers would clutter this page up too much.
    – Alex D
    Commented Aug 1, 2014 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.