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

WIP: Template precompilation #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP: Template precompilation #82

wants to merge 1 commit into from

Conversation

pootsbook
Copy link

This is a work-in-progress attempt to get precompiled templates. I've got alert_message precompiling but it's not getting added into the build correctly. I'm not sure how it would fit into the module declarations (if it has to) or at what point it could be included in the concatenation.

Suggestions please!

@dmathieu
Copy link
Contributor

Take a look at what ember-rails does. It includes templates into the minified files.

The idea is that it adds the templates into the global Ember.TEMPLATES array.
Templates are then automatically picked by ember.

@pootsbook
Copy link
Author

Understood. The difference with ember-rails is that it has no module system, i.e. it uses the manifest to deal with dependencies and the templates are included that way.

If you build ember-bootstrap with this pull request the template is added to Ember.TEMPLATES but it gets put inside a self-invoking anonymous function. The other modules seem to get exported with the EmberAddMicroLoader filter so I'm unsure if Ember.TEMPLATES gets exported to the global namespace. It certainly isn't picking it up in the tests. I'll experiment with a couple of different strategies:

  • Trying to get the templates into the build outside the modules
  • ensuring Ember.TEMPLATES gets assigned to window or exported appropriately

@dmathieu
Copy link
Contributor

I don't see any text template in the emberjs repository. Do you know of any repository which does something similar ?

@tomdale @wycats: any feedback would be much appreciated here 😊

@pangratz
Copy link
Contributor

I think the only template which is still needed in Ember.js, is the one for the select control: ember-handlebars/lib/controls/select.js#L327

@dmathieu
Copy link
Contributor

And it's precompiled the same way we do here.
Getting rid of the templates in ember-bootstrap would be impossible unfortunately.

@pootsbook: Ember.TEMPLATES being a subnamespace of Ember, which gets assigned to window, it should too.

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

Successfully merging this pull request may close these issues.

None yet

3 participants