Open dejurin opened 4 years ago
Unfortunately it's probably not possible to solve in a general case. Mustache templates usually aren't valid HTML, so any minification will likely break :-/
Yesterday Im was experiment with this. This can be applied when the file is cached.
It would be useful to influence the content before writing to the cache.
But if we allow that, it's non-deterministic and we can't guarantee the sanity of the cache.
If you want to do something like this, a good place to do it would probably be in a custom loader.
Thank u.
I was found a very simple solution. In file Compiler.php change in function text($text, $level)
$code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
on
$code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export(trim($text), true));
I added only trim function, and got minify html.
PS: If this solution will be test OK, your will maybe added this option?
How about make minify cache template how like this https://github.com/jenstornell/tiny-html-minifier possible?