Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

assets_for_text

2 sites Security covered
View on drupal.org

Allows you to configure asset libraries (JavaScript, CSS) to be loaded on pages based on the presence of keywords in textareas.

Features

Cause an available "library" (Drupal JS and/or CSS assets defined in a module, theme or profile) to be loaded on pages showing HTML that is marked up with specified CSS classes or CSS identifiers (as defined in a text area, generally by a WYSIWYG like CKEditor).

Post-Installation

  1. Go to /admin/config/content/assets_for_text_key and press "+ Add Library Key pair"
  2. Enter a CSS class (preceded by .) or ID (preceded by #) that should cause a library to load.
  3. Select the library you want to load.
  4. Save.
  5. Edit your textarea to include that class or ID or, if already present, trigger a cache reload.

(Editing the relevant text format should not be necessary as it is automatically added to all of them. Now that i think of it this seems rather heavy-handed for text-only formats.)

Additional Requirements

No additional requirements.

Certainly something that provides CSS or JavaScript as a Drupal attachments library that you want to add to certain text.

Similar projects

None known though certainly plenty of projects do add CSS and JS; maybe they could integrate with this one to do so in a more targeted manner.

Supporting this Module

You can support Agaric's overall contributions to Drupal and a bit beyond by supporting Drutopia at opencollective.com/drutopia. Thanks!!

Activity

Total releases
2
First release
Oct 2025
Latest release
6 months ago
Release cadence
0 days
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha1 Pre-release Oct 13, 2025
1.0.x-dev Dev Oct 13, 2025