Micromodal library definition as a separate module?

Created on 13 April 2023, almost 2 years ago
Updated 9 June 2023, over 1 year ago

If I would like to make a contrib module which works with image media type, where I display a placeholder with lower resolution and then when I click it it opens in bigger resolution with micromodal, then I would need to define my own version of the library, and then that could result in some problems later, or where I would have the same library defined twice on the same place.

Instead wouldn't it be better to have a separate contrib module that can be listed as a dependency which defines the library?

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary nagy.balint

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nagy.balint
  • Assigned to scott_earnest
  • Status changed to Closed: won't fix over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Hello @nagy.balint-

    This module is geared specifically for oembed videos. I'm not sure I fully understand the question, but this module is dependent on the micromodal.js library. Perhaps you could leverage that for images? Please let me know if this is helpful or needs further discussion.

    https://micromodal.vercel.app/

  • πŸ‡­πŸ‡ΊHungary nagy.balint

    The module loads the js library as

     js:
        https://unpkg.com/micromodal@0.4.10/dist/micromodal.min.js: { type: external, minified: true }

    in media_video_micromodal.libraries.yml

    This means that it simply pulls the lib from external source.

    This also means that if I would like to make a contrib module that also works with this micromodal, but for image media,
    then I also need to implement a libraries yml and pull the library as an external source.

    In case I use both modules, then it will potentially pull it in twice, but at least when the version changes in one of the modules, will certainly pull it in twice.

    The solution could be to have a micromodal contrib module which the other modules depend on, then we can avoid that problem.

    Or to have a solution where we can include the library through composer, with for example the merge plugin. But in the current situation even if the other module used composer, this module would still pull the library in as an external.

Production build 0.71.5 2024