Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

how to Reuse code in multiple projects but keep a single copy of it on your disk

how to Reuse code in multiple projects but keep a single copy of it on your disk?

Well, I am not sure, how much it can increase the productivity. But I think it will be cool by doing so and it can save disk space :P

2 Answers

It's hard to answer this question without knowing the context of which language you are talking about using. Although, in most situations, this concept won't necessarily reduce disk space in the way you think it would.

  • So which language(s) are you asking this about?
  • How might you be wanting to save/reference this code?

Without knowing that info, you can easily 'save code' for use later by storing a piece of standalone code in a text file/gist on github or snippet manager.

I agree with Joe Beltramo if you want to save a component use Gist from github or if not you can create a folder locally and save a folder of your work there. Gist is way better or also create a repo if it's a component, you will be able to clone that repo into any project you want.