Dabolus / polymer3-webpack-starter-kit

Polymer 3 Starter Kit with Webpack
MIT License
55 stars 6 forks source link

Consider switching to EJS #49

Closed Dabolus closed 5 years ago

Dabolus commented 6 years ago

Handlebars is great for templating, but it might lead to confusion because it uses the same syntax as Polymer (i.e. {{ code }}). EJS is as great as Handlebars, but it offers a quite different syntax (i.e. <%= code %>). Using this syntax will not only avoid any confusion, but it will also allow to use Polymer and EJS altogether (for example, it would be possible to inject some environment variable or app config property directly inside Polymer elements)

Dabolus commented 6 years ago

EJS loader seems to add some overhead to the built project, so I'm not sure it will be the right choice. The best choice would definitely be handlebars, but its syntax goes against Polymer syntax, so we just can't use it (maybe we can build a custom handlebars version with different delimiters?)

logicalphase commented 6 years ago

Yes, handlebars I think would be confusing with Polymers 2 way data binding. I think you can make it work, but doubt it would be worth the trouble.

I've used others, like Marko, etc., but Polymer always sought the agnostic route with templates. I'll report back if I think of or find anything that looks promising.

On Sat, Mar 31, 2018, 3:03 PM Giorgio Garasto notifications@github.com wrote:

EJS loader seems to add some overhead to the built project, so I'm not sure it will be the right choice. The best choice would definitely be handlebars, but its syntax goes against Polymer syntax, so we just can't use it (maybe we can build a custom handlebars version with different delimiters?)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Dabolus/polymer3-webpack-starter-kit/issues/49#issuecomment-377719500, or mute the thread https://github.com/notifications/unsubscribe-auth/AYC27UTuixHjFW-9HFHLUDYuFZXMbCEvks5tj-ElgaJpZM4Sw1cq .

ZempTime commented 6 years ago

Chiming in here, you're already using html-webpack-plugin, which seems to have the necessary functionality for this kinda thing! Not ejs, but lodash templating. (Which might be ejs, it looks exactly the same, I have no idea.)