voku / HtmlMin

:clamp: HtmlMin: HTML Compressor and Minifier via PHP
MIT License
161 stars 22 forks source link

Escaping issues with Mustache.js templates #77

Closed c-gross closed 2 years ago

c-gross commented 2 years ago

What is this feature about (expected vs actual behaviour)?

Own Mustache.js templates written as inline script tags are getting escaped which is destroying the result html. Tried using nocompress tag but did not help.

How can I reproduce it?

<script id="test-tpl" type="x-tmpl-mustache">
<span>Foo</span>
</script>

Result:

<script id="test-tpl" type="x-tmpl-mustache">
<span>Foo<\/span>
</script>
voku commented 2 years ago

@c-gross can you try overwriteSpecialScriptTags

$htmlMin = new voku\helper\HtmlMin();
$htmlMin->overwriteSpecialScriptTags(['x-tmpl-mustache']);
c-gross commented 2 years ago

Amazing, it's working with that option.