2

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!

1

2 Answers 2

1

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!

Sign up to request clarification or add additional context in comments.

1 Comment

Yea, that's kinda what I've been doing. I've been using git's submodules with a repository of any reusable components
0

How about making a library with the reusable components in a separate project and upload it to npm as a package?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.