11

I just integrated Tern with my editor of choice, and the experience has been pretty incredible so far.

One thing that would make the experience all the more intuitive, however, would be the ability to tap into my existing front- and back-end dependency management systems (i.e. the bower.json and package.json files) rather than having to manage the .tern-project file manually.

Is there some existing way of doing this?

user456584
  • 86,427
  • 15
  • 75
  • 107

1 Answers1

12

Setting something like this in your .tern-project should be enough to get it aware of dependencies loaded through your package.json:

{
  "plugins": {
    "node": {}
  }
}

As for bower components, you can follow these steps to get decent completion:

  • Ensure that you have a build step that copies all main js assets from your bower components into a known directory (tools like wiredep are great for this kind of thing).
  • Set that directory into your loadEagerly property.

That'd look something like this:

{
  "loadEagerly": [
    "path/to/Bower/dir/**/*.js"
  ]
}

If your Bower components really rely on them loading in a specific order, you could either list them in the right order in the loadEagerly list, or use the simpler approach of concatenating all these Bower components into a single file and just mentioning that in the loadEagerly list.

bilalq
  • 7,279
  • 3
  • 22
  • 28