The module currently does not provide a global Critical CSS configuration to act as a fallback
when no contextual match is found. To improve the initial experience and avoid manual setup,
a default Critical CSS option managed via simple config is needed.

Key Technical Points

  • Create a simple configuration object: critical_css_ui.settings.
  • Add the default_critical_css key to store the global CSS fallback.
  • Add a boolean default_enabled to toggle the fallback on or off.
  • Provide an initial configuration file inside config/install.
  • Create a configuration schema in config/schema/critical_css_ui.schema.yml.
  • Expose an admin settings form to edit the default Critical CSS configuration.
  • Integrate the fallback into the resolution logic:
    node:ID → node:bundle → default.
  • Invalidate caches whenever the configuration is updated.
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

diegodz created an issue. See original summary.

diegodz’s picture

Issue summary: View changes
diegodz’s picture

Parent issue: » #3558157: RoadMap

sergeydruua made their first commit to this issue’s fork.

sergeydruua’s picture

Status: Active » Needs review

Implemented the default Critical CSS configuration logic as requested. Changes include: Updated schema and install config to support default_enabled and default_critical_css. Updated CriticalCssConfigForm to include the new fields with #states visibility. Refactored CriticalCssConfigForm to use Dependency Injection properly. Updated CriticalCssProvider::getCriticalCss() to fallback to the default configuration if no context match is found. Tested manually and verified that the fallback CSS is applied when expected.

diegodz’s picture

Hi @sergeydruua,

Thank you for your contribution. I’ll review the MR as soon as I have some available time and will merge it into the 1.0.x branch.

Thanks again for your support!

diegodz’s picture

Assigned: Unassigned » diegodz

diegodz’s picture

Status: Needs review » Reviewed & tested by the community

  • diegodz committed 78b7557f on 1.0.x authored by sergeydruua
    Issue #3558158 by Industrial Media/sergeydruua: Create default Critical...
diegodz’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

diegodz’s picture

Status: Fixed » Closed (fixed)