Problem/Motivation

A new add_js command was added to core 9.5 by #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS, and add_css may be updated to a CSP-compatible implementation (although with a fallback until 11.0) in 10.1 #3110517: Improve Drupal\Core\Ajax\AddCssCommand to accept an array of CSS assets

Instead of the current custom implementation (that combines css and js into a single asset response), the module should backport the commands as necessary instead.

Proposed resolution

Update module classes & javascript to backport core code when necessary

Remaining tasks

API changes

Issue fork csp-3323011

Command icon 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

gapple created an issue. See original summary.

gapple’s picture

Module compatibility bumped to ^9.5 || ^10 so that we can take advantage of core's add_js command and the loadjs library added in 9.5, and only backport the necessary code for add_css from 10.1.

On 10.1+, CSP Extras is just a no-op, and adds a warning to the status page notifying that it can be uninstalled.

gapple’s picture

Title: Update csp_extras to follow add_js / add_css in core » Update csp_extras to backport add_css from core 10.1

  • gapple committed b70cc81f on 8.x-1.x
    Issue #3323011 by gapple: Update csp_extras to backport add_css from...
gapple’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.