Add local library discovery, CDN library definition as fallback

Created on 27 January 2025, 2 days ago

Problem/Motivation

Currently this module defines two Drupal library definitions for the noUIslider JS library:

  • nouislider/nouislider (references local copy packaged with module)
  • nouislider/nouislider-cdn (references CDN-hosted version)

This forces developers wanting to use noUIslider in their project(s) to have to choose between the local copy packaged with this module or the CDN version and also forces them to use the version defined by this module.

Proposed resolution

It would be better for this module to:

  • Provide a single noUIslider library definition
  • Reference a CDN-hosted version of the library in the library definition as a fallback.
  • Use the core LibrariesDirectoryFileFinder service in a hook_library_info_alter() implementation that replaces the CDN references in the library definition with the local copy of the library if one is found.

This would follow the "Load local library first, use CDN as fallback" approach described in the d.o. documentation for *.libraries.yml β†’ .

Remaining tasks

  1. Create MR
  2. Merge MR
  3. Update documentation on project page.

User interface changes

API changes

Data model changes

🌱 Plan
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024