4

According the Ember CLI documentation, pods are supported out the box. Github issue #142 says generators should "just work" with pods. This answer suggests it should just work too. However, when I try ember generate model XXX, it generates /models/XXX.js, instead of /pods/XXX/model.js.

Again, per the documentation, I added podModulePrefix to my app.js file:

var App = Ember.Application.extend({ modulePrefix: 'app', podModulePrefix: 'app/pods', Resolver: Resolver });

If I manually create files using pod syntax, the resolver picks it up, so I know the app is configured properly, but I do not know what I need to do to get Ember CLI generators to respect pod syntax. Am I missing something?

Community
  • 1
  • 1
Ryan
  • 605
  • 7
  • 14
  • 1
    You need the `--pod` option. –  Feb 02 '15 at 13:23
  • For those reading this in 2015 :) it's worth noting that as of March, there is an open PR to remove the `podModulePrefix` option from Ember CLI: https://github.com/ember-cli/ember-cli/issues/3424 – Max Wallace Nov 20 '15 at 20:23

3 Answers3

3

CHANGED: Sept 24, '14 This merge request was recently pulled in: https://github.com/stefanpenner/ember-cli/pull/1994 which will add the flag --pod to ember-cli generators.

Don't forget to add podModulePrefix as per the current ember-cli docs.


OLD: Currently pods are not supported in ember-cli blueprints. It is a feature still in dev, here is the discussion: https://github.com/stefanpenner/ember-cli/issues/1619

genkilabs
  • 2,966
  • 30
  • 36
2

Not sure what version this was added, (i am currently on 1.13.8), but as of right now, you can edit your .ember-cli file at the root of your project, and add,

"usePods":true

to the file. This will make the cli use pods by default, and you don't need to pass the --pods or p option during usage. The .ember-cli in JSON format, so if that's your only config, the complete file would look like:

{
    "usePods": true
}
Brian Vanderbusch
  • 3,313
  • 5
  • 31
  • 43
1

As of ember-cli 0.1.5, you can generate pods with the shorthand version of the --pod option:

ember g <blueprint> <name> -p

Pods can be generated from several built-in blueprints that support them, however there are some blueprints (such as mixin, util, service, and a few more) where pod structure does not make sense, and the generate command will ignore the pod flag (generating in basic structure).

It should also be noted that pods can be generated in the app/ folder as well, and do so when podModulePrefix is not present. In fact, podModulePrefix will be deprecated as of ember-cli 0.2.1, and you will need to move any pods from app/pods to app/.

trabus
  • 71
  • 1