Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions includes/class-asset-enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ final class Asset_Enqueue {
*/
private $stylesheet_dependencies = array();

/**
* Array of stylesheet URLs to be used as dependancies for enqueued stylesheets.
*
* @var string[]
*/
private $stylesheet_dependency_sources = array();

/**
* Initializes the process.
*/
Expand Down Expand Up @@ -131,15 +138,24 @@ function () {
* Enqueues a site editor stylesheet for all manifests.
*/
private function enqueue_editor_stylesheets() {
foreach ( $this->manifests as $manifest ) {
$style = $this->get_manifest_style( $manifest, 'vite-entry-points/admin.js' );
add_action(
'init',
function () {
foreach ( $this->stylesheet_dependency_sources as $source ) {
add_editor_style( $source );
}

if ( is_null( $style ) ) {
continue;
}
foreach ( $this->manifests as $manifest ) {
$style = $this->get_manifest_style( $manifest, 'vite-entry-points/admin.js' );

add_editor_style( $style['url'] );
}
if ( is_null( $style ) ) {
continue;
}

add_editor_style( $style['url'] );
}
}
);
}

/**
Expand Down Expand Up @@ -203,6 +219,7 @@ function () use ( $handle, $src, $dependencies, $version, $media ) {
);

array_push( $this->stylesheet_dependencies, $handle );
array_push( $this->stylesheet_dependency_sources, $src );
}

/**
Expand Down