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-bundle dependencies missing to include inky_to_html-filter, resulting in error when updating translations #34586

Closed
knallcharge opened this issue Nov 25, 2019 · 8 comments

Comments

@knallcharge
Copy link
Contributor

Symfony version(s) affected: 4.4.0

Description
After updating from Symfony 4.3 to 4.4 (changing composer.json manually and using composer update), I'm faced with the error message "In body.html.twig line 1: Unknown "inky_to_html" filter." when trying to update my translations (bin/console tran:up ).

How to reproduce
Migrate Symfony to 4.4 by changing composer.json & calling composer update
Execute php bin/console tran:up

Possible Solution
When in the project directory, adding the dir to the command is a workaround:
php bin/console tran:up .

Additional context
https://stackoverflow.com/questions/59029924/symfony-4-4-unknown-inky-to-html-filter also has my composer.json (as I can't attach it here)

@knallcharge knallcharge changed the title twig-bundle dependencies twig-bundle dependencies missing to include inky_to_html-filter, resulting in error when updating translations Nov 25, 2019
@abdounikarim
Copy link
Contributor

abdounikarim commented Nov 25, 2019

Hello @knallcharge,

Did you add the library with :
composer require twig/inky-extra ?

Cheers 😉

@knallcharge
Copy link
Contributor Author

That's what the bug is all about: shouldn't the requirement be added automatically?

@abdounikarim
Copy link
Contributor

i think... no. Because you can use twig without this.

@knallcharge
Copy link
Contributor Author

Symfony 4.4 requires symfony/twig-bridge and that requires twig/inky-extra, but is not included when using composer update. Please check the stackoverflow-link.

@stof
Copy link
Member

stof commented Nov 25, 2019

@fabpot weren't we ignoring Twig templates producing a syntax error when extracting translations, instead of failing the whole extraction ?
That's what is happening here. The new zurb email templates depend on twig/inky-extra, but that is an optional dependency of the twig-bridge, as it is not needed for all other features of the bridge.

@jbdelhommeau
Copy link
Contributor

I have the same error. I don't want to install twig/inky-extra because I don't need it.
I'm willing to do an MR.

@fabpot
Copy link
Member

fabpot commented Nov 29, 2019

@stof No, we weren't ignoring errors. See #34711 for a fix.

@fabpot fabpot closed this as completed Nov 30, 2019
fabpot added a commit that referenced this issue Nov 30, 2019
…ntax error (fabpot)

This PR was merged into the 3.4 branch.

Discussion
----------

Fix the translation commands when a template contains a syntax error

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #34586
| License       | MIT
| Doc PR        | n/a

When using `debug:translation` or `translation:update`, we should catch exceptions to avoid breaking the command. It was not really an issue before Symfony 4.4/5 as we didn't have templates in the core that use features from optional dependencies.

Commits
-------

7f803bc Fix the translation commands when a template contains a syntax error
@burned42
Copy link
Contributor

I see this is supposed to be fixed, but I just started using translations and got the same error message complaining about missing inky_to_html and markdown_to_html when calling lint:twig (after seeing that translation:update would remove all my translations, because it says they're unused).

To get rid of the error message and to get lint:twig "green" again, I had to install twig/extra-bundle, twig/inky-extra, twig/markdown-extra and because after I installed those, it started to complain about missing inline_css filter, I also had to install twig/cssinliner-extra. Note that I'm not using any of those filters in my code/templates.

Am I supposed to install all those packages manually, or is there maybe a problem that brought this issue back?

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

6 participants