13 ms·
lit-html surely does a good job.. - ES6 string literals - partial template rendering are few cool features with it.
by itsbits 8y ago
lit-html surely does a good job..
- ES6 string literals
- partial template rendering
are few cool features with it.
- lauritzsh 8y agoI haven't looked much into lit-html but is it possible to type check your templates like you can do with JSX? That is one big advantage I found for JSX compared to template-based frameworks.
- spankalee 8y agoIt's possible. There's a VS Code extension that does this already called lit-plugin. If it becomes easier to add TypeScript compiler plugins via configuration, then I'm sure one will appear, allowing errors at build time.
- Technetium_Hat 8y agoAll components, expressions, etc are in template curlies `${}` so type checking works out of the box. If you mean type checking on HTML properties, no it does not. Lit HTML seems very extensible, so it should be possible to add support for thus.
- westbrookj 8y agolit-html is great! - no build step - ergonomic - fast - flexible - useful whether alone or in a library/framework wrapper (see LitElement, https://lit-element.polymer-project.org/ https://lit-element.polymer-project.org/, Haunted, https://github.com/matthewp/haunted https://github.com/matthewp/haunted, et al.) Getting just about all the convenience of JSX with the ability to have your templates run in pure JS in the browser, with no build step is pretty rad. Even if the difference is just a few seconds here or there, multiply that by the amount of work I'm supposed to be getting done in a day, and it starts to add up. It's also nice to have control over whether to work with attributes or properties. A level of control that is mirrored by having direct access to event binding (rather than an abstraction of it) so you can pin down whatever custom events you might be passing around your application. Maybe that's my favorite part, you get control. Whether via the time you get back, the say you have over your templates, the interoperability of your code, you have it with lit-html in a way that JSX hasn't really allowed me to in my experiences with it.