Importing Templates in Meteor During Routing with Iron Router
<p>One of the benefits to Meteor is that you only need to load content when it needs to be rendered, e.g. if you have a template file in /imports/ui/client it is not loaded unless you import it somewhere. However, when using Iron Router I've been unable to determine how I should include a template only when it needs to be rendered via the appropriate route. One approach I've tried is declaring the import in the route function:</p>

<pre><code>Router.route('/', function () {
  import '/imports/ui/client/home.js';
  this.render('home');
});
</code></pre>

<p>This succeeds in loading the template file, though I've not seen any examples in the Iron Router documentation doing it this way and I've had some JavaScript issues that I didn't have previously, as such I'm doubtful this is the right/best approach.</p>

<p>When using Meteor with Iron Router what is the best way to include templates only when they're needed? </p>