-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
8.xfeature addition proposalProposal to add to an existing featureProposal to add to an existing feature
Description
Proposal
Several CSS and JS libraries are currently loaded on every page regardless of whether they are needed. This impacts Core Web Vitals (LCP, CLS) for all sites using the theme.
The following assets are loaded unconditionally (acknowledged with @todo Include only if needed comments in dxpr_theme.theme):
- Bootstrap 5 override CSS (
dxpr_theme.theme:254) — loaded even when Bootstrap 5 components aren't on the page - Enhanced dropdowns (
dxpr_theme.theme:261) — loaded even when no dropdown menus exist on the page - Drupal Webform CSS (
dxpr_theme.theme:265) — loaded even when the Webform module is not installed - DXPR Builder CSS (
dxpr_theme.theme:265) — loaded even when the Builder module is not installed
Proposed solution
Implement conditional #attached logic in dxpr_theme_preprocess_page() or hook_page_attachments_alter() to:
- Only attach webform CSS when the
webformmodule is installed (\Drupal::moduleHandler()->moduleExists('webform')) - Only attach DXPR Builder CSS when
dxpr_buildermodule is installed - Only attach enhanced-dropdowns library when a menu block with dropdowns is present on the page
- Evaluate whether Bootstrap 5 overrides can be scoped more narrowly
Expected impact
- Reduced CSS payload on pages that don't use these features
- Improved Lighthouse performance scores
- Better Core Web Vitals, particularly for content-heavy landing pages
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
8.xfeature addition proposalProposal to add to an existing featureProposal to add to an existing feature