Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engines breakpoint templates must be in app/ #102

Closed
dustinfarris opened this issue Dec 23, 2016 · 7 comments
Closed

Engines breakpoint templates must be in app/ #102

dustinfarris opened this issue Dec 23, 2016 · 7 comments

Comments

@dustinfarris
Copy link

dustinfarris commented Dec 23, 2016

Summary

layouts in /my-engine/addon/templates/**/-layouts/* are not compiled.

Details

ember-engines encourages you to put everything in addon/ and doesn't even create an app/ folder in the blueprint. This includes templates. ember-engines automagically re-exports everything it needs so that it is available at runtime.

Flexi compiles breakpoint templates (e.g. -layouts/mobile.hbs) in preprocessTree, where it is handed all the known templates at that time. Flexi extracts and compiles the stuff in -layouts folders, and then merges it back in with the rest.

The problem seems to be that ember-engines has not re-exported the templates yet at this stage in preprocessTree, rather it does not happen until Engines starts piecing things together in some very sophisticated treeFor* callbacks. So, if you have a breakpoint template in my-engine/addon/templates/index/-layouts/mobile.hbs, it will be merged into a big 'ol app tree eventually (not sure how lazy-loading plays in here), but not in time for flexi.

https://github.com/ember-engines/ember-engines#addontemplates

@rwjblue
Copy link
Contributor

rwjblue commented Dec 27, 2016

As far as I can tell (from the description and conversations in slack) this is actually not directly related to ember-engines at all (though it is indirectly related). The more fundamental issue is that ember-cli currently does not call preprocessTree / postprocessTree AT ALL for addon's addon/ trees. When using ember-engines, you are advised to basically "put everything" into addon/ which is why this seems to affect ember-engines specifically.

The good news is that I submitted a PR a while back to ember-cli that fixes this exact issue, and @nathanhammond is helping to land it (fleshing out more tests in the space and whatnot). The related PR is ember-cli/ember-cli#6516.

@RobbieTheWagner
Copy link
Member

It seems the PR @rwjblue mentioned has been merged. Does this fix the issue @dustinfarris?

@kybishop
Copy link
Collaborator

@dustinfarris ^

@runspired
Copy link
Collaborator

I believe the other thing is that you have to move the layout compiler into dependencies instead of dev-dependencies for the engines.

@RobbieTheWagner
Copy link
Member

@dustinfarris can you try this out and do as @runspired suggested please?

@RobbieTheWagner
Copy link
Member

Going to close this, due to lack of response from @dustinfarris. If it's still an issue, feel free to reach back out!

@bravo-kernel
Copy link

Confirmed, moving flexi-layouts into dependencies solves everything.

No need for service injection inside the engine either, it just works as expected, picks up all the various -layouts directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants