The Problem: Sharing a header and footer between two repos that use different technologies - one is Rails and the other is PHP. They are on different subdomains.
Current Implementation: Up until this point we have just been copying and pasting the code between the repos since they have been mostly static. We will be using more JS in the header and footer in the near future
Proposed ideas:
1) Convert the header and footer to an npm package.
Pros: These packages can be installed independently in the different repos and files could be referenced from the source as needed. This is a more modular approach.
Cons: Any asynchronous requests will need to be handled ideally by an API or by one of the two servers. Logic for handling this will need to be in the JS layer.
2) Use git submodules/subtrees
Pros: No need for an external dependency
Cons: Cumbersome to set up (from what I remember) and the problem of asynchronous requests will still need to be handled.
Option #1 seem to be the better one of the two (in this case) but I'm wondering if there are flaws that I am not seeing with it. Are there any additional approaches that I am missing which are worth investigating?