Search code examples
javascriptember.jsember-app-kit

Ember - Sharing code between two EAK projects


I hava two emberjs projects both use EAK as the basic project structure. There are some common code i want to share between these two projects: templates, views(and the related stylesheets) some utility classes etc. But there are some doubts i want to figure out:

  1. Should i put the common code into a separate eak project?
  2. Should i use some package manager(bower maybe) to mange project dependency?
  3. EAK use its custom resolver to find ember classes under specific directories(views,controllers etc), so should i copy the common code into these directories or just extend the resolver to write my own finding logic?

Any push in the right direction will be a tremendous help! Thank you.


Solution

  • We have a similar situation. We scaffolded with Yeoman which means we have bower for dependencies and grunt for building. I'm not sure how this applies to EAK, so take it with a grain of salt.

    Our decision was to keep the common code in a separate project. It got a little complicated working through all of the dependencies, and in the end it involved doing some grunt build work to make sure that exactly everything we needed (nothing more or less) got included from the common project when it was added as a dependency to child projects via bower. A dependency manager like Bower is critical because you'll want to be able to pin your child projects (consumers, whatever) to a specific version of the common code while you work on new features therein.