Closed Igloczek closed 6 years ago
Minifier can't handle a new line after quote and double-quote. It wasn't a case with ES5, b/c it will generate not valid code, but with template literals, we can do this i.e. writing HTML code.
Simple example:
var test =`" test "`;
Real-life example:
return template(` <div class=" ${classNames.item} ${classNames.itemChoice} ${data.disabled ? classNames.itemDisabled : classNames.itemSelectable} " data-select-text="${this.config.itemSelectText}" data-id="${data.id}" data-value="${data.value}" data-sku="${data.sku}" data-choice ${data.groupId > 0 ? 'role="treeitem"' : 'role="option"'} ${data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable'} > ${data.label} </div> `);
Note that's a backtick ` and not a single quote '. At first I thought you were mistaken, but just found out about backticks in Javascript :-)
`
'
Works now.
Minifier can't handle a new line after quote and double-quote. It wasn't a case with ES5, b/c it will generate not valid code, but with template literals, we can do this i.e. writing HTML code.
Simple example:
Real-life example: