mercredi 27 juillet 2016

Why doesn't ember cli generate app bridge for hbs file when generating component from addon?

When I run ember g component foo-bar in an Ember Addon project (let's say addon-project), it generates following:

// addon-project/addon/components/foo-bar.js
import Ember from 'ember';
import layout from '../templates/components/foo-bar';

export default Ember.Component.extend({
  layout
}

// addon-project/addon/templates/components/foo-bar.hbs


// addon-project/app/components/foo-bar.js
export { default } from 'addon-project/components/foo-bar';

I noticed that it does not generate addon-project/app/templates/components/foo-bar.js to export the component template but explicitly link the template using layout.

Why not generate addon-project/app/templates/components/foo-bar.js? Is there a reason for this behavior?

Also why is layout imported using relative path instead of absolute path (i.e. import layout from 'addon-project/templates/components/foo-bar?




Aucun commentaire:

Enregistrer un commentaire