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

PLANET-7625: Move scripts away from Twig templates #2502

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mardelnet
Copy link
Contributor

@mardelnet mardelnet commented Jan 16, 2025

Summary

This PR removes JS scripts from the Twig templates and enqueue them correctly using WordPress methods and Webpack.


Ref: https://jira.greenpeace.org/browse/PLANET-7625

Testing

  1. Visit a page using a comments form (i.e., this one) and check if the behavior is consistent with the logic of assets/src/js/toggle_comment_submit.js. Check the script is not loading on the pages not using a comments form.
  2. Visit a page using share buttons (i.e., this one) and check if the behavior is consistent with the logic of assets/src/js/share_buttons.js. Check the script is not loading on the pages that are not using share buttons.
  3. Visit any page (i.e., this one) and check if the behavior is consistent with the logic of assets/src/js/hubspot_cookie.js

Notes

There's still one Twig template using JS scripts: templates/blocks/google_tag_manager.twig.
Another PR was be opened for it because of its complexity: #2503

@mardelnet mardelnet self-assigned this Jan 16, 2025
planet-4 added a commit to greenpeace/planet4-test-deimos that referenced this pull request Jan 16, 2025
/unhold 83279419-b56c-4bef-a1e0-3a3f85efb3ec
@mardelnet mardelnet changed the title PLANET 7625: Move scripts away from Twig templates PLANET-7625: Move scripts away from Twig templates Jan 16, 2025
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Jan 16, 2025
/unhold e72c5194-204d-41d4-a2ed-f5053a60512a
@planet-4
Copy link
Contributor

planet-4 commented Jan 16, 2025

Test instance is ready 🚀

🌑 nix | admin | blocks report | CircleCI | composer-local.json

⌚ 2025.01.16 20:38:32

@mardelnet mardelnet marked this pull request as ready for review January 16, 2025 14:41
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Jan 16, 2025
/unhold 60ddcb6a-3d6b-4e0d-b6e9-a9e6f95f6b63
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Jan 17, 2025
/unhold 1398557b-c023-4bc6-bbbf-927488377481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants