3 ms·
You don't need a compiler to do that. lit-html does this at runtime, and the benefit from not diffing static content is large.
by spankalee 7y ago
You don't need a compiler to do that. lit-html does this at runtime, and the benefit from not diffing static content is large.
- nojvek 7y agoat compiler time, you can type check and statically validate. Doing things at runtime with lit-html where things are in a string, quickly falls apart in a large project. One of my biggest griefs with Angular was that you could miss an ending tag in the template and it would work fine until it blows up in production when a customer accesses that specific scenario. I stay away from magic templates compiled at runtime. I've been bitten way too many times. Plus it's not good for load performance when you have to ship a string compiler with your code.
- spankalee 7y agoHow do you think lit-html templates would fall apart? There's nothing magic about them. They has as defined semantics as HTML or JavaScript - both of which are languages written as strings. We use lit-html in thousands of components at Google with very strict type-checking and linting. You simply aren't allowed to miss an end tag, or bind to a non-existent attribute or property. The performance and code size are excellent, beating every major framework including those using compilers. The "compiler" we use is simply the HTML <template> element and a tree-walk. It's very, very fast and very, very small.