Closed gitKrystan closed 9 months ago
Option A, less text nodes. Also, very few templates will be one line.
If there is an element in there tho, option b
Relevant RFC looking to address the whitespace difference: https://github.com/emberjs/rfcs/issues/982
As mentioned by @NullVoxPopuli, would this imply a template with a single element would also be on one line as follows?
export default class MyComponent extends Component {
<template><h1>Hey shorty</h1></template>
}
Or would it then switch to a new line?
export default class MyComponent extends Component {
<template>
<h1>Hey shorty</h1>
</template>
}
Because for that case I also would prefer option b.
As mentioned by @NullVoxPopuli, would this imply a template with a single element would also be on one line as follows?
In the current implementation, yes.
oh, I'd prefer the link breaks then
trying v2 right now, which is producing one-liners with html tags is not giving the visual cue for the template I'm trying to find.
the short version is nice for tests though 😇
Update:
I got this working, which is how the JSX formatter works:
One line if there is no tag:
<template>Hey shorty</template>
Multi lines if there is a tag:
<template>
<h1>Hey shorty</h1>
</template>
Multi lines if there is a block and you wrote the block as multiline:
<template>
{{#if true}}
Hey shorty
{{/if}}
</template>
One line in this case too:
<template>{{if true 'Hey shorty'}}</template>
Vote by reacting to this issue. Comment with more details below. Do you prefer:
Option A (🚀)
This is what v2.0.0-0 is currently returning.
Option B (👎)
This is what v1 currently returns.
Caveats
Neither of these solutions address the issue that whitespace matters in html. 🙈 I haven't had any issues reported here about whitespace causing issues so I am choosing to ignore that for now.