Shopify / sprockets-commoner

Use Babel in Sprockets to compile JavaScript modules for the browser
MIT License
182 stars 22 forks source link

JSX Support #53

Open jtomaszewski opened 7 years ago

jtomaszewski commented 7 years ago

I rebased https://github.com/Shopify/sprockets-commoner/pull/22 to current master , added a test for react .jsx file and registered jsx mime_type in sprockets, so now it works out of the box, if only you include babel-preset-react in your .babelrc file.

What do you think?

thijsc commented 7 years ago

I was also looking into doing a jsx transform and couldn't get it to work out of the box with .coffee files. It does work with .js files by default though. So I'm not sure why you need this pull. Why don't you just rename your js.jsx files to js?

jtomaszewski commented 7 years ago

Because of highlight syntax in my editor [Atom], I prefer to differentiate my jsx files from js .

Another approach would be to set this up in the editor. (but every dev would propably have to do it on his own because https://github.com/editorconfig/editorconfig/issues/190 )

thijsc commented 7 years ago

Ah right, that makes sense. We're also running into a possibly related issue by the way: https://github.com/Shopify/sprockets-commoner/issues/59

thijsc commented 7 years ago

This pull looks really good to me, anything holding back a merge?