-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Allow variables starting with dollar sign ($) #313
Comments
Hi @nussjustin-hmmh, thanks for the contribution. I'm not sure about the #314 change since I copy pasted the regex from Twig/Twig If you look at https://fiddle.nette.org/twig/#df4ba04b4a IMHO we may split twig.js support and twig support. If twig.js is based on twig, do you know where come from the extra support for I might consider introducing (here
but first I'd like to understand the way twigjs works. |
Ok, I just realised that I didn't think this through. Shopware does use twig.js but only for Blocks and not for the actual output. That is done via Vue.js, which means any That also means that running Twig-CS-Fixer on the templates is probably not even worth it trying. Sorry for the trouble. I'd say we close this issue and the PR. WDYT? |
Indeed |
Context
We'd like to use Twig-CS-Fixer for our Shopware projects (custom plugins / Symfony bundles).
Shopware uses Twig both directly from PHP, but also from JavaScript via twigjs/twig.js.
Since twig.js implements the same syntax as the reference Twig implementation, Twig-CS-Fixer mostly works fine, but we ran into a little problem:
Shopware uses a Variable / Function called
$tc
for translations (e.g.$tc('hello')
). Note the dollar sign at the start.While this is supported by twig.js, the reference Twig implementation and Twig-CS-Fixer do not support variables starting with a dollar sign.
For compatibility it would be nice for Twig-CS-Fixer to also allow the dollar sign at the start of variables.
Expected behavior
Variables starting with a dollar sign can be parsed.
Write here.
Actual behavior
Tokenizing fails.
The text was updated successfully, but these errors were encountered: