handlebars-lang / handlebars.js

Minimal templating on steroids.
http://handlebarsjs.com
MIT License
18k stars 2.04k forks source link

handlebars to JSX converter would be big right now. #1142

Closed faceyspacey closed 8 years ago

faceyspacey commented 8 years ago

Jade has a transpiler: https://github.com/jadejs/react-jade

The JSX debate needs to be put to rest by giving developers the option to use whatever templating option they want. I'm not sure what's the most popular, but I always thought it was Handlebars.

Is this in the works?

kpdecker commented 8 years ago

The htmlbars project's goal is to take the handlebars syntax and expose it in a virtual dom. I believe development there is primarily driven by the Ember teams, but it's entirely possible that that could be adapted to work with React's virtual dom.

Handlebars proper won't support this though as we actively focus on being unaware of what content we are generating and adding HTML semantics would require large breaking changes for every helper, etc.

On Wed, Dec 2, 2015 at 3:59 PM James Gillmore notifications@github.com wrote:

Jade has a transpiler: https://github.com/jadejs/react-jade

The JSX debate needs to be put to rest by giving developers the option to use whatever templating option they want. I'm not sure what's the most popular, but I always thought it was Handlebars.

Is this in the works?

— Reply to this email directly or view it on GitHub https://github.com/wycats/handlebars.js/issues/1142.

faceyspacey commented 8 years ago

ic. what about an official addon/extension package that converts to JSX. I mean it just IS such a big opportunity that will be missed out because of semantics (i'm talking the business "semantics" of handlebars "proper" supporting it vs an extension vs. adding HTML semantics vs just getting the job done for the common use case of handlebars to JSX vs whatever). ...Coming directly from handlebars would have a way larger impact than a bunch of shoddy community packages that will crop up (and are already in the works, but struggling to become feature complete).

kpdecker commented 8 years ago

The complexity is the same in that you have to become aware of two languages, handlebars and html and this project actively avoids that. If you feel that there are community projects that are close to doing what you want to see but aren't there yet, why not spend some time getting them up to snuff? Community projects are a good thing, which is why we actively link to anyone who requests that we do so in our readme.

devinrhode2 commented 5 years ago

One major issue I have with handlebars is having no idea which variables are defined. With jsx/hyperscript, I don't have to wonder about this at all, once I understand how the html syntax transpiles over to javascript code.

Another major issue I have with handlebars is the sheer unique-ness of it's syntax. It's a whole new language. JSX, on the other hand, is simply an obvious mixing of some html syntax into javascript. I can't just do collection.map or array.filter - I have to lookup some unique syntax in the docs on emberjs.com. There's no standard either. The whole rest of the javascript ecosystem seems to have come to gather around jsx.

stevenvachon commented 5 years ago

The JavaScript ecosystem has not gathered around JSX; the React community has.

Anyway, I started on handlebars-react but never finished it due to available time but also some problems with reusing handlebars runtime helpers.