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

Emit used components in a template #69

Closed
khornberg opened this issue Mar 3, 2016 · 1 comment
Closed

Emit used components in a template #69

khornberg opened this issue Mar 3, 2016 · 1 comment

Comments

@khornberg
Copy link

Is there a way to emit or list the used components in a template?

Basically, in my application that has an addon with 1000 components, I only want to include the components that I actually use in the application.

My thought is that if I can get a list of components used, then I can filter the tree in addon hooks.

I see in the compiled form of a template:

statements: [["content", "outlet", ["loc", [null, [11, 0], [11, 10]]]], ["content", "component-one-from-addon", ["loc", [null, [14, 0], [14, 19]]]], ["content", "component-two-from-addon", ["loc", [null, [17, 0], [17, 17]]]]],

Is there any registry of used components?
When and where would that be available at build time?

This may be related to #47
Also related: http://discuss.emberjs.com/t/how-to-include-only-a-subset-of-the-files-from-an-addon/9099

@stefanpenner
Copy link
Contributor

The template compiler itself would need to provide this (something i have wanted for ages). Unfortunately some templates may include {{component dynamicName}} or {{context.component}} the later may delegate the component to specify such dependencies. the former ... well im sure something creative could be used.

I would recommend this instead by opened as an RFC to the ember repo, as the ember repo currently provides the actual template compiler. This project merely integrates it with broccoli + ember-cli.

A second RFC, eg. tree-shaking to ember-cli is likely fine, i can say that is a goal we have, but no timeline as of yet.

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

2 participants