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

Consider components with a / (and no -) in their name to be valid. #10407

Closed
tim-evans opened this issue Feb 9, 2015 · 17 comments
Closed

Consider components with a / (and no -) in their name to be valid. #10407

tim-evans opened this issue Feb 9, 2015 · 17 comments

Comments

@tim-evans
Copy link
Contributor

This is a pain point with code organization on our app. We currently have 90 component definitions in /components, and I would like to push some of these components into a folder for organizational purposes.

For a small sample, we have artwork-weight, artwork-piece, artwork-image, artwork-dimensions, artwork-image-approver, as components organized under the artwork vertical.

I'm also willing to hear other organizational strategies (like pods), but I'll need some guidance, and I'm hesitant to move to pods unless there are major positives to this.

For current info on our app, we're on 1.8, upgrading to canary and running on ember-cli

I've been working also on refactoring our application in the process of upgrading to canary, since we were using workarounds and patterns that are no longer supported.

Thanks!

@rwjblue
Copy link
Member

rwjblue commented Feb 9, 2015

This should "just work" with Ember 1.9 and above.

@workmanw
Copy link

workmanw commented Feb 9, 2015

That's curious, how would the ES6 resolver know where to look for a component in a sub folder? I thought the pods and otherwise functioned by having predictable structures.

Edit: I too would love this feature. We have 30 components currently. And when we replace itemControllers with components we'll have about 50.

@chnn
Copy link

chnn commented Feb 9, 2015

I'm also unable to get this to work. Do you still need a dasherized name when a component is nested? For example will moving a reports-list component to reports/list not work because it should be reports/list-something? Or maybe it's the combination of the component pod structure and the slash? (I am on Ember 1.10 and Ember CLI 0.1.12)

Edit: It seems to be the combination of the component pod structure and the nested nature. This structure:

components
└── reports
    └── user-list
        ├── component.js
        └── template.hbs

throws an unfound helper error when using {{#reports/user-list}} {{/reports/user-list}} in a template.

@tobyzerner
Copy link

Working fine for me. You do still need a dasherized name.

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

Made a demo repo. See this commit: rwjblue/components-in-subdirs@2109939

@rwjblue rwjblue closed this as completed Feb 10, 2015
@lolmaus
Copy link
Contributor

lolmaus commented Feb 10, 2015

@workmanw:
That's curious, how would the ES6 resolver know where to look for a component in a sub folder? I thought the pods and otherwise functioned by having predictable structures.

I had the same concern, but @nathanpalmer kindly explained that this is not an issue at all.

@workmanw
Copy link

@lolmaus Yea given that the subdirectory is part of the name that makes sense.

One thing I'm still curious about is how this will play out once HTMLBars has shed it's Handlebars templates. Will the following just keep working?

<subdir1/template-only random-string="something passed in the application.hbs">
</subdir1/template-only>

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

Yes.

Also, htmlbars will not stop allowing the usage of mustaches. You will likely always use curlies for things like '{{if}}', '{{each}}', etc.

@workmanw
Copy link

@rwjblue Hey thanks for the quick reply!

@tim-evans
Copy link
Contributor Author

@rwjblue I think you misunderstood. I would like to consider artwork/weight valid. I would like the regex to be dash -or- slash.

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

@tim-evans - Interesting idea. Flagging for discussion at the next core team meeting...

@tim-evans
Copy link
Contributor Author

Thanks! :3

@stefanpenner
Copy link
Member

i like this

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

As do I.

@nathanpalmer
Copy link

Seems like this might already be partially supported.

@tim-evans
Copy link
Contributor Author

@nathanpalmer nope, not yet

return key.indexOf('-') === -1;

@tim-evans tim-evans changed the title Consider components with a / in their name to be valid. Consider components with a / (and no -) in their name to be valid. Feb 10, 2015
@stefanpenner
Copy link
Member

basically this boils down to / isn't valid HTML, in theory we may be able to move to : or some other delimiter. This is a high priority to solve as part of the new angle components, stay tuned.

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

No branches or pull requests

8 participants