Description
I keep bringing this up as a thing-we-should-do but it's probably time we had an issue for it with specific ideas about what it means and how to get there.
I'll kick things off with a few ideas of things we could do:
Static properties
<!-- App.html -->
<Greeting name='world'/>
<!-- Greeting.html -->
<h1>Hello {{name}}!</h1>
Right now, this involves creating three separate text nodes inside the <h1>
(which we could collapse into one — Scott Bedard had some good ideas in Gitter), and adding update code that waits for state.name
to change. We could replace all that with
h1.textContent = 'Hello world!';
Static computed properties
As a corollary to the above, if you know the values of the inputs to a computed property, and know that the computed property function is pure, you can precompute the value.
Collapsing entire components
A 'component' is really two things — the main fragment, and the interface. In a lot of cases, such as the <Greeting>
component above, we don't actually need the interface — we can statically determine that there are no lifecycle hooks or events, and no way that the user could get a reference to the component.
Optimising styles
Component-level unused style removal is cool, but if we had all your styles we could start to do Styletron-style optimisations.
Will add to this list as other things occur to me; please suggest others!