Problem/Motivation
Looking to use the preload extension— are there any tips or best practices for adding HTMX extensions in Drupal? Should i make a module, even if only a libraries.yml file, so others just find it and don't have to think about it?
Steps to reproduce
Proposed resolution
Submodule in this module.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork htmx-3553907
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mlncn commentedThis is working— definitely needs documentation, and i was wondering if it is feasible to place
hx-ext="preload"into the body tag, since it is annoying to have to add that to something outside of / before thedata-hx-get="…" preloadtag/line.Would be great to have a little feedback now, including if the documentation should go in a help topic.
Comment #3
mlncn commentedLike it would be great to somehow use https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Htmx%21Ht... to add to the
<body>tag whenever the htmx_preload/preload library is loaded on the page.Comment #4
fathershawnThanks for pushing me to open 1.6.x! We have things to remove that have been added in 11.3 to core.
Let's add a folder for extensions in
docs. I'll move the debugging extension page there as well.I think you are on the right track in #3. I'm doing that manually here: https://git.drupalcode.org/project/htmx/-/blob/1.5.x/modules/htmx_debug/... but now we have the
Htmxobject.Comment #5
fathershawnComment #6
fathershawnComment #7
fathershawnWe will also need a README with sha values like we have for debug and you will want to add a
hook_preprocess_htmlto add the attribute tobodyas is done inhtmx_debug.