Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig 3 Compatibility #15

Open
toxpal opened this issue Nov 25, 2019 · 10 comments
Open

Twig 3 Compatibility #15

toxpal opened this issue Nov 25, 2019 · 10 comments

Comments

@toxpal
Copy link

toxpal commented Nov 25, 2019

Hi @nochso

I'm using your html-compress-twig for a few years and like it very much. I see it doesn't get much updates, but it works well, so it's fine :)

However, I noticed it doesn't work with Twig 3, which was released recently. Do you have any plans to support it? If not, maybe you can refer to some other maintained plugin which does that?

Thank you.

@StasToken
Copy link

I am also interested in this question, I spent all day today trying to find something similar on the Internet, but not a single analogue can twig 3

@antiftw
Copy link

antiftw commented Jul 20, 2020

Hi @nochso

Bump, since I've been having the same problem migrating my cms to Symfony 5, which uses twig 3.0 ;) Have spent multiple days now looking for something with similar functionality and that also works without much hassle, without any success.

Thanks in advance,

PS. I don't even mind doing so myself, since I have the idea there are no major changes required, just a version bump, or am I wrong and are you dreading the day to start the rewrite?? haha ^^ Have never worked with submitting anything myself to packagist/github so you would have to give me some pointers where to start ;)

@ekyazilim
Copy link

Hi @nochso
I'm eagerly awaiting the upgrade to twig 3. thanks..

@MarelPup
Copy link

MarelPup commented Aug 24, 2023

@toxpal
Copy link
Author

toxpal commented Aug 24, 2023

Yes, I switched to the solution mentioned above (wyrihaximus/html-compress) earlier, but it doesn't minify inline JavaScript code...

@MarelPup
Copy link

MarelPup commented Aug 24, 2023

strange, considering

    public function __construct($forceCompression = false)
    {
        $this->forceCompression = $forceCompression;
        $this->parser = Factory::constructSmallest();
        $this->callable = array($this, 'compress');
    }

    public function compress(Twig_Environment $twig, $html)
    {
        if (!$twig->isDebug() || $this->forceCompression) {
            return $this->parser->compress($html);
        }
        return $html;
    }

doesn't seem to be a different implemetation of wyrihaximus ' basic compression

@toxpal
Copy link
Author

toxpal commented Aug 25, 2023

Sorry, my bad, I used it earlier (can't remember the reason, but I had to look for another solution), and switched to https://packagist.org/packages/voku/html-compress-twig later

@MarelPup
Copy link

It's ok, i had already moved to a homemade solution when writing my first comment , i think i'll use this solution

@toxpal
Copy link
Author

toxpal commented Aug 25, 2023

If I understand right, you use wyrihaximus/html-compress as a base + some custom code?

@MarelPup
Copy link

yes, I use kernel.response , as cited in the stackoverflow link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants