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
- Go to
/admin/config/content/assets_for_text_keyand press "+ Add Library Key pair" - Enter a CSS class (preceded by
.) or ID (preceded by#) that should cause a library to load. - Select the library you want to load.
- Save.
- 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.
Recommended modules/libraries
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!!
Project information
Seeking co-maintainer(s)
Maintainers are looking for help reviewing issues.- Project categories: Content display, Content editing experience
1 site reports using this module
- Created by mlncn on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
Releases
Initial release of a working module
Development version: 1.0.x-dev updated 14 Oct 2025 at 04:18 UTC
