Re: [w3c/webcomponents] HTML Modules (#645)

@schlm3 There are basically two options for single-file components right now:

1. Use .js as the file and write HTML templates in JS. Polymer 3 does this by simple including out HTML-based template syntax as a string. LitElement does this by using tagged template literals to put only the static parts of templates into strings and move the binding expressions into native JavaScript. This has a lot of benefits to some users when you consider that the data you're trying to interpolate into template instances exists in JS already and is naturally accessible there.
2. Use a tool that compiles HTML to JavaScript modules. The is essentially the Vue approach and there are other tools to do this for lit-html, internal tools at Google, etc. This approach still lets you leverage the JS module loader system so dependencies are correctly loaded, ordered, etc. It does force you to decide on answers to all the questions the HTML Modules proposal brings up though, and is essentially a compile-time polyfill for the idea.

Until HTML Modules proceeds, that's about what you can do.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/645#issuecomment-454908946

Received on Wednesday, 16 January 2019 19:31:25 UTC