Active
Project:
Drupal core
Version:
main
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Jul 2014 at 12:32 UTC
Updated:
27 Jan 2020 at 06:33 UTC
Jump to comment: Most recent
Some sites want to compile Twig (and container) on staging and deploy to production with production being readonly PHP wise. We need a twig compiler for them.
Go over all the .html.twig files and compile them (easy).
Recursive grep for #template; tokenize those files; iterate tokens until #template is found then skip ' ] => = tokens and compile the next string.
Write this.
Comments
Comment #1
chx commentedComment #2
gábor hojtsyWould #template only ever be used for twig templates? I mean some other type of element can easily use this for a template of something else, no? How do you plan to find the template elements?
Comment #3
chx commentedLet's hope they don't? Check for {{}} or | present in the template?
Comment #4
gábor hojtsyWell, that is a strategy too. Looks like a quick grep of code now only reveals the new additions.
Are you only planning to support the inline array syntax?
''... => '...'vs.['...'] = '...'that is. These are classic questions we go through in potx to figure out what kinds of rules we can impose on people.Comment #5
chx commentedComment #6
lauriiiComment #7
darol100 commentedThis can be done with drush..
drush twig-compileComment #14
Andre-BGiven PHP preloading might be landing with PHP 7.4. https://wiki.php.net/rfc/preload
precompiling twig caches and moving them to memory might be come a huge performance gain.
proposing a status change of this issue.
Comment #17
bradjones1