0

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?

dipole_moment
  • 5,266
  • 4
  • 39
  • 55
  • 1
    Don't use submodules. Don't do it. They seem good, but you'll hate yourself the first time you need to figure out what branch an old version was supposed to be using. – ssube Nov 15 '16 at 16:42
  • Yeah we used to use them in my previous gig and they were a total nightmare. – dipole_moment Nov 15 '16 at 16:46

0 Answers0