-
Notifications
You must be signed in to change notification settings - Fork 6
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
288: Removes async, adds data attribute #7
Conversation
I've updated #4 to include this change, hopefully this'll prevent any merge conflicts if this PR is merged first |
@evanmwillhite I've given this a try, but I'm getting errors in my console to do with missing jQuery, because my component library scripts are trying to run before my global library (which contains jQuery) is being loaded in the footer (this is done before I think we could prevent this by doing some more data-attribute trickery, for example, instead of using
We could use:
And then use the JS in Emulsify to swap the data-src for an actual src. This way, the libraries won't actually be loaded until |
Great idea, @philwolstenholme! I've made this change here and it is working well for me (see latest on fourkitchens/emulsify#288). Can you verify on your end? |
Hi @evanmwillhite , I tried to test this but the patch (https://patch-diff.githubusercontent.com/raw/drupal-pattern-lab/attach-library-twig-extension/pull/7.patch) wouldn't apply as I'm already applying #4 as a patch and they both change the same lines. Would it be possible for you to review and merge in #4 ? |
@evanmwillhite I wonder if we also need to do something to defer Emulsify's call to At the moment I'm doing something similar in my theme to what this PR proposes, but I tried adding this to the end of
But it's still called too soon, presumably because even though the Edit: for now I've done something very basic in
|
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.
Code and functional review pass.
@philwolstenholme I used some of your code here, but I wanted to see if I could avoid the timeout since it could be variable. I pinged you on the other one already - just wanted to note it here. |
Companion to fourkitchens/emulsify#288, this removes the troublesome async attribute and replaces it with a data attribute that is detected in JS by a new script in the companion PR.