fix(javascript): remove unnecessary linebreaks from html templates (#5771)
parent
1dea4ef6f2
commit
42f7b6025e
|
@ -610,18 +610,8 @@ function printHtmlTemplateLiteral(path, print, textToDoc, parser) {
|
|||
}
|
||||
|
||||
const placeholderIndex = +component;
|
||||
|
||||
parts.push(
|
||||
concat([
|
||||
"${",
|
||||
group(
|
||||
concat([
|
||||
indent(concat([softline, expressionDocs[placeholderIndex]])),
|
||||
softline
|
||||
])
|
||||
),
|
||||
"}"
|
||||
])
|
||||
concat(["${", group(expressionDocs[placeholderIndex]), "}"])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,15 @@ html\` <\${Footer} >footer content<// > \`
|
|||
|
||||
html\` <div /> \`
|
||||
|
||||
function HelloWorld() {
|
||||
return html\`
|
||||
<h3>Bar List</h3>
|
||||
\${bars.map(bar => html\`
|
||||
<p>\${bar}</p>
|
||||
\`)}
|
||||
\`;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
import { LitElement, html } from "@polymer/lit-element";
|
||||
|
||||
|
@ -110,5 +119,16 @@ html\`
|
|||
<div />
|
||||
\`;
|
||||
|
||||
function HelloWorld() {
|
||||
return html\`
|
||||
<h3>Bar List</h3>
|
||||
\${bars.map(
|
||||
bar => html\`
|
||||
<p>\${bar}</p>
|
||||
\`
|
||||
)}
|
||||
\`;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
|
|
@ -50,3 +50,12 @@ html`<my-element obj=${obj}></my-element>`;
|
|||
html` <${Footer} >footer content<// > `
|
||||
|
||||
html` <div /> `
|
||||
|
||||
function HelloWorld() {
|
||||
return html`
|
||||
<h3>Bar List</h3>
|
||||
${bars.map(bar => html`
|
||||
<p>${bar}</p>
|
||||
`)}
|
||||
`;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue