Ryan
Ryan

Reputation: 615

Ember CLI with pod syntax

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?

Upvotes: 4

Views: 2562

Answers (3)

Brian Vanderbusch
Brian Vanderbusch

Reputation: 3339

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
}

Upvotes: 2

trabus
trabus

Reputation: 71

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/.

Upvotes: 1

genkilabs
genkilabs

Reputation: 2986

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

Upvotes: 3

Related Questions