Astra_Dark_Mode_Cache::force_dark_palette_css_on_cache( string $css )
Force generation of dark-palette CSS when assets are written to files.
Description
Astra’s dark mode styles are normally added only when the dark palette is active. When dynamic CSS is cached to static files, these rules might be missing if the palette wasn’t enabled at build time. This filter ensures the rules are created regardless, so they are available whenever dark mode is toggled later.
Parameters
- $css
-
(string) (Required) Dynamic CSS accumulated from previous filters.
Return
(string) Modified CSS including dark-palette rules when needed.
Source
File: classes/cache/class-astra-dark-mode-cache.php
public function force_dark_palette_css_on_cache( $css ) { // Check if dynamic CSS is being generated as a file instead of inline. if ( class_exists( 'Astra_Cache_Base' ) && ! Astra_Cache_Base::inline_assets() ) { $css = astra_dark_palette_css( $css, true ); } return $css; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.11.2 | Introduced. |