Dear Templating — Sincerely, JSX Part 1


Great comparison and writing style. I was lacking exactly such an approach. Please keep up doing great job. Thanks !

1 Like

Thanks @nabu1. Are you switching to React?

Great. As you call it Part I, I assume there will be continuation.

Then, in Part II, can you please show us how exactly can we write JSX using both Jade and CoffeeScript in Meteor applications? If JSX is so powerful and so easy to implement in Meteor, I guess making it work with Jade and CS would be piece of cake?

Unfortunately out of the box JSX doesn’t support coffeescript. But you can use this to do a transform if you’d like.

And same goes with Jade. We’re not necessarily making JSX work with these, but giving parallels for conversion. I can do some Jade Examples but they’ll be pretty much deconstructing jade into html and putting it into JSX. Heres a jade jsx library. Kinda awkward though:

This is by far one of the most encouraging blog posts I’ve ever read on this topic.

Writing styles goes a long way and @abhiaiyer’s is very welcoming, as opposed to many others’ which are downright condesending.

Keep it up!

@energistic perhaps you should do a few pieces covering these posts!

Heres a jade jsx library. Kinda awkward though:

Yeah I’ve tried to make it work with Meteor + Webpack some time ago but I failed. And failed even more to make it work together with CS.

Jade+CS is a preferred tool stack for many Blaze users. And I bet they wouldn’t mind switching to React that much, if React, or at least Blaze2, provided a good experience using both.

It’s tough man. Not everything is going to be 1to1 right. I guess your mileage may very. React has its own set of opinions and “way” of doing things. I think before getting into any of the customizations, learning it first will help you realize if you really need jade or coffeescript.

It’s not a matter of “do I really need it”. Can I write code without Jade or CoffeeScript? Yes I can, just like I can write websites without React or even without Meteor. I’ve coded for years without Jade and CoffeeScript.

But when I see HTML or JSX now, the code looks sad. The code whispers to me “I want to be written with Jade and CS, I don’t want this verbose syntax”. And if my code looks sad, I feel sad too. I don’t want to feel like that while coding, I want it to be a fun experience.

How I see it, there shouldn’t be any problems making Jade+CS JSX, just like it can to HTML and JS. Yet somehow, there are. I believe Blaze2 should be written with that option in mind and I hope @gschmidt and @evanyou will take it to heart. :smile:

But in overall, I enjoyed your article and your approach.

1 Like