Add safe list definitions for components to ensure correct display when CSS generated locally

Created on 20 February 2025, 16 days ago

Problem/Motivation

CSS class names are generated programatically in may Twig templates. TailwindCSS processors are unable to identify all class names being used, and therefore do not include their definition in locally generated CSS files.

The solution is to provide a static list of all possible classes that could be be dynamically generated- this will ensure that all the classes that would eventually be used, would be included in the locally generated CSS files.

Steps to reproduce

1. Create a new Drupal site and install the UI Suite DaisyUI theme
2. Configure the theme to generate CSS files locally (Install NPM packages, etc., and build CSS)
3. Enable to possibility to view the DailyUI Components (/admin/appearance/ui/components
4. Browse the components - not all will display correctly

Proposed resolution

- Add an extra Twig file per folder that will contain an (unused) assignment defining all CSS classed used by the component in question.

Remaining tasks

- Add the attached files to their respective folders in the theme
- Rebuild the local generated CSS (npm run build)
- Clear Drupal cache (drush cr)
- Browse the components - the updated components should display correctly

User interface changes

none

API changes

none

Data model changes

none

Feature request
Status

Active

Version

5.0

Component

Code

Created by

🇱🇺Luxembourg paddy_deburca

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