-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSX Support #53
base: master
Are you sure you want to change the base?
JSX Support #53
Conversation
549c28f
to
b7c60f2
Compare
register_postprocessor 'application/javascript', ::Sprockets::Commoner::Processor | ||
register_transformer 'application/json', 'application/javascript', ::Sprockets::Commoner::JSONProcessor | ||
register_transformer 'application/jsx', 'application/javascript', ::Sprockets::Commoner::JSXProcessor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much for.. it just tells the sprockets that 'application/jsx' can be transformed into 'application/javascript' so it can be later included in the 'js' files.
Or we could just tell it that '.jsx' files are '.js' files stright away , by:
register_mime_type "application/javascript", extensions: [".js.jsx",".jsx"], charset: :unicode
Or maybe there's some another better way to do it. I'm not sure, I'm not really familiar with sprockets yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just adding the .jsx
extension as an acceptable application/javascript
extension is better
I was also looking into doing a jsx transform and couldn't get it to work out of the box with |
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 editorconfig/editorconfig#190 ) |
Ah right, that makes sense. We're also running into a possibly related issue by the way: #59 |
This pull looks really good to me, anything holding back a merge? |
ad92ca6
to
b7c60f2
Compare
I rebased #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?