voku / HtmlMin

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

Twig extension doesn't work since Twig 3.9.0 #101

Closed toxpal closed 3 weeks ago

toxpal commented 4 months ago

Since https://github.com/voku/html-compress-twig has no "Issues" section, I hope it's ok to post issue here.

The last version of Twig where HtmlMin extension works is 3.8.0. Upgrading to any later version doesn't cause any errors, but source code is not minified. I suspect it has something to do with changes to internal functions in Twig - https://github.com/twigphp/Twig/blob/3.x/CHANGELOG, for example:

 * Deprecate all internal extension functions in favor of methods on the extension classes
 * Mark all extension functions as @internal

Any chance we will get it working on Twig 3.9.0 and later?

mshannaq commented 3 months ago

Since https://github.com/voku/html-compress-twig has no "Issues" section, I hope it's ok to post issue here.

The last version of Twig where HtmlMin extension works is 3.8.0. Upgrading to any later version doesn't cause any errors, but source code is not minified. I suspect it has something to do with changes to internal functions in Twig - https://github.com/twigphp/Twig/blob/3.x/CHANGELOG, for example:

 * Deprecate all internal extension functions in favor of methods on the extension classes
 * Mark all extension functions as @internal

Any chance we will get it working on Twig 3.9.0 and later?

@toxpal I used Twig 4.5.1 in Symfony 7.1 and I use HtmlMin 4.5.1 to minify Twig output and I have no issue with that.

toxpal commented 3 months ago

I used Twig 4.5.1 in Symfony 7.1

Are you sure? The latest version of Twig is 3.10.4, v4.0.0 is in early development, and v4.5.1 doesn't seem to exist?

P.S. I'm using the extension, not standalone HtmlMin

mshannaq commented 3 months ago

I used Twig 4.5.1 in Symfony 7.1

Are you sure? The latest version of Twig is 3.10.4, v4.0.0 is in early development, and v4.5.1 doesn't seem to exist?

P.S. I'm using the extension, not standalone HtmlMin

This the versions that I have used:

I used it in symfony 7.1

and the minify operations done without any noted problem.

toxpal commented 3 months ago

Well, for some reason Twig extension of HtmlMin stops working when Twig version newer than 3.8.0 is used.

toxpal commented 3 weeks ago

After updating to Twig 3.12.0 extension automatically started working again. No other changes were made...