Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

move drupal js loading to head, reload scripts #288

Merged
merged 9 commits into from
Dec 4, 2018

Conversation

evanmwillhite
Copy link
Contributor

@evanmwillhite evanmwillhite commented Sep 7, 2018

Attempt to fix #287

Companion PR (must be merged together): drupal-pattern-lab/attach-library-twig-extension#7

  • Moves Drupal scripts/symlinking instructions to PL head file
  • Adds JavaScript to reload JavaScript files inserted within patterns using attach_library

Testing:

  1. Test as standalone Emulsify installation
  2. Test inside of Drupal by using behaviors and following the wiki instructions (will need to be updated a little to reflect the change if we include this).
  3. Test any other way you can think of to make sure this is working OK (on client projects, etc.)

Notes:
Tested in latest Chrome, Safari and Firefox, IE Edge and 11.

@philwolstenholme
Copy link
Contributor

Hi @evanmwillhite, this looks like it'll solve part of the JS problem I was having earlier today. Quick question though, where is the data-name attribute added? I can't see a reference to it in https://github.com/drupal-pattern-lab/attach-library-twig-extension or in Emulsify?

@evanmwillhite
Copy link
Contributor Author

@philwolstenholme thanks for letting me know. There needed to be a companion PR in the attach_library repo. I've created that and referenced it above!

amazingrando
amazingrando previously approved these changes Nov 21, 2018
@evanmwillhite
Copy link
Contributor Author

@philwolstenholme I've tweaked the reloading script here to both wait until the scripts have been loaded and run Drupal.attachBehaviors() if applicable. Can you verify this is working for you? Thanks!

@evanmwillhite
Copy link
Contributor Author

Also, @philwolstenholme I fixed this as a part of it.

@evanmwillhite
Copy link
Contributor Author

Nevermind, I'm getting inconsistent attachBehaviors experiences depending on the number of scripts loading. Moving back to WIP.

Copy link
Contributor

@ModulesUnraveled ModulesUnraveled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@evanmwillhite evanmwillhite merged commit 1c39e48 into develop Dec 4, 2018
@evanmwillhite evanmwillhite deleted the attach_library-fixes branch December 4, 2018 22:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting Drupal.behaviors to work in PL
4 participants