How can I figure out the paths to import stuff from meteor packages?

Hi,

For example the Meteor Blaze tutorial contains an example import declaration:
import { Template } from 'meteor/templating'

How can I guess this path?
When I look at the ./meteor/packages file I see blaze-html-templates@1.0.4 in it not templating.
When I go to the Meteor github repository, I also do not find such package.

So then, I continue my search to the Blaze developers site and look at the Template Declarations section of the API documentation.

There, next to the import { Template } from 'meteor/templating' declaration, I see the blaze/template.js, line 477 . Clicking on it nicely gets me to the source code defining the Template object that I need to import in my file containing the Spacebar or Jade template helpers and event handlers.

So the question is, why shoudn’t I have to do:
import { Template } from 'blaze/template' or
ìmport { Template } from 'meteor/blaze-html-templates/template' instead of
import { Template } from 'meteor/templating'

Thanks for clarifying this point

You don’t have to guess. Just read the documentation. See for instance, http://blazejs.org/api/templates.html

Well yes, the doc does says that it should be:
import { Template } from 'meteor/templating'
for this particular case.

I wanted to understand the systematic scheme and logic behind those naming conventions and hence why:

  • having meteor instead of blaze since the package has moved from the meteor core to a separated blaze project;
  • having templating which neither corresponds to the package name blaze-html-templates nor to template the file name where to find the Template object in the blaze project.

import { Mongo } from 'meteor/mongo'
in contrast is fair enough since there is a package called mongo in meteor