-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update twig support from github.com//pull/129
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I just wanted to let you know that this commit caused a problem (way) downstream. This is just for info, not to give blame. I know my project is not managing dependencies in a perfect way, to say the least. More details are here: https://github.com/michaellenahan/blog/wiki/PHP-Fatal-error:--Uncaught-Twig_Error_Syntax:-Unknown-%22asset%22-function
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michaellenahan thx for the info. I dont have too much experience with twig so I ask you: would it be better for the general public to inject only into .html.twig files (and are .twig files like in your example partial html tempaltes that get injected into a final html.twig file?=
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't speak for the "general public", my expertise is more with back-end development. What I can say is: if you only injected into .html.twig files that would certainly help me, it would not break my deployment.
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does your gulp taks look like? Are the src only *.twig files or can you use *.html.twig to seperate those from the non-wanted files?
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source file where the unwanted injection occurred was called
_01-foot.twig
the problem was caused because suddenly *.twig files were amended instead of as before, *.html.twigSo, if you go back to just amending *.html.twig files that would fix my particular issue.
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For info, I've just cross-posted this issue to the issue queue of the pattern lab drupal theme - that's what I'm using in my Drupal site that has a dependency on
gulp-inject
: phase2/pattern-lab-drupal-theme#7831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you post your gulp code nonetheless?
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, to my sense it's not a good idea to verticalize the twig injection trough the asset function. This function is not part of Twig core, it's a Symfony extension (https://symfony.com/doc/3.4/reference/twig_reference.html#asset). A project can use Twig without Symfony!
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pixadelic since I dont understand all the technical stuf in your post: is that an advice to @michaellenahan ?
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if it's unclear but my comment was for you. I redo in a more correct way: transform.twig.* will wrap automatically the injected string in an asset() function. That the point I was discussing because the asset() function is not bundled with Twig package (as seen at https://twig.symfony.com/doc/2.x/), but it's part of the Symfony framework.
Hence it's possible to use twig without having asset() function available. So the new gulp-inject twig feature is nice but can break some task processes. But it's not a big deal, thank a lot for this module!
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this wrapping feature opt-in or at least opt-out? The wrapping into
asset
function is breaking my deploy process, because Symfony is apparently checking weather the files actually exist. Because of some cache-busting I'm doing along side injecting files into my twigs, they don't actually exist and deploy fails.For now I'm reverting to 4.3.1.
831d4b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would glady accept any PR to make this feature opt-out and get your progress back on track. COuld you make one for this or do you need help?