facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.
http://facebook.github.io/jsx/
1.96k stars 133 forks source link

adding Jade like compact indented JSX syntax via option in babel parser #60

Closed neurall closed 8 years ago

neurall commented 8 years ago

This PR comes from a conversation in babel/babylon#61 where I proposed adding the ability to use compact indented JSX syntax via option. I implemented indented mode plus tests in Jsx Parser in babel/babylon#61 and also in fork of acorn-jsx. indented mode is activated via parser indented:true,locations:true options . There are no changes to normal Jsx control-flow/state. For the full rationale see that issue, here’s an abridged version: What you guys think ? If compact jsx mode is too crazy than I appologize I just lost job and all of the sudden got creative ;D and such

var App  =  <div>
                <drawer> 
                    <menu>
                        <item>
                <area>
                    <toolbar>
                    <content>
loganfsmyth commented 8 years ago

My gut reaction is adding a indentation-sensitive language inside a indentation-insensitive language seems pretty rough.

sophiebits commented 8 years ago

I don't think we'd want to do this in the official JSX spec but if you want to build an extension like this on your own, go for it.

neurall commented 8 years ago

I see the point. Should we name it as new language / babel plugin then ? Any idea about name ? I guess JadeX ?