asyncLiz / minify-html-literals

Minify HTML template literal strings
MIT License
68 stars 14 forks source link

Error when commenting html literals #49

Open liorwohl opened 1 year ago

liorwohl commented 1 year ago

If I try to comment HTML code that has template literal in it I get an error "Error: splitHTMLByPlaceholder() must return same number of strings as template parts"

It faild with both styles of comments:

<!--${this.showRiskIcon ? html`
  <tr>
    <th>Risk</th>
    <td><risk-icon .entityObj="${this.domain}" .commandPostName="${this.commandPostName}"></risk-icon></td>
  </tr>
` : ``}-->

and / or

${/*this.showRiskIcon ? html`
  <tr>
    <th>Risk</th>
    <td><risk-icon .entityObj="${this.domain}" .commandPostName="${this.commandPostName}"></risk-icon></td>
  </tr>
` : ``*/}

I would really like some way to comment code in templates that will still work with the minifier.

Using version 1.3.5 with minify-html-literals-loader 1.1.1

Thanks