Reputation: 145
I'm working on multiple projects, and I'm finding that I reusing the same components, sometimes with minor changes, in a lot of these projects (like a Header or a Footer component). I'm wondering what is the best way for me to include these common components in all my projects so that if I have to update one (i.e., make a change to the Header component) that I don't have to go into each project to make that change? To clarify, I know that I may have to rebuild the bundles for the individual projects, I just don't want to have to keep up with 50+ copies of the same Header component. Any ideas? I'm using VueJS 2 and all projects are stored in git repositories.
Thanks!
Upvotes: 2
Views: 504
Reputation: 329
How about making a library with the reusable components in a separate project and upload it to npm as a package?
Upvotes: 0
Reputation: 2100
I'm running into the same issue - apparently re-usable components means re-using in only one project.
If you are using git, perhaps create a branch containing only the reusable components (only the components directory, not a complete project structure). Check that repository out into the src directory of your actual project (which is a git branch itself).
As long as you don't add the shared branch to the outer project, all should be well!
Upvotes: 1