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?
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