tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.61k stars 193 forks source link

Standard helpers for use outside Ember #433

Open timkendrick opened 8 years ago

timkendrick commented 8 years ago

Just wondering if there are any plans to bundle a set of standard HTMLBars helpers (if, each, etc) so that it can be comfortably used outside Ember?

I've been really impressed with using HTMLBars so far, and I'd love it if there were a minimal-but-batteries-included core package for smaller apps that don't justify the whole Ember experience. Are there plans to continue developing HTMLBars as a standalone library with documentation etc (like Handlebars, I guess), or will it eventually just be subsumed into the Ember core?

I'd be happy to help if there's anything I can do to further this – I've tried to extract out a few of the core helpers from Ember's ember-htmlbars package but a) it's hard not to end up yanking out the whole kitchen sink with them, and b) a lot of the behavior seems to be radically different when used outside Ember (e.g. inline if helper within an attribute seems to throw errors, or return "undefined" instead of "", etc), so I'm not sure whether this is the right approach to take. I'd be grateful for any advice as to whether it's better to carry on with this or just to start from scratch and write a whole new set of helpers.

Background: I'm currently working on a backend Node app that allows user-uploaded templates, so Handlebars/Mustache seems like the only safe route. Page content and styling need to be fully user-customizable, so I've hooked up a client-side HTMLBars preview where the user can live-edit colors, fonts etc and have the page instantly rendered exactly like it will on the server. Due to HTMLBars, this now works incredibly smoothly – thanks guys!

mmun commented 8 years ago

@timkendrick I am a big fan of this idea. I've wanted to include the base operators in htmlbars core for a while (and, or, not, etc.). A new version of glimmer will soon be arriving so I've been waiting until then.

timkendrick commented 8 years ago

@mmun that sounds amazing! My main concern was that HTMLBars would only exist to serve Ember's needs, but it's a great library and I'd love to see it become something in its own right - I really feel it's got mass appeal. Looking forward to seeing how things progress!