Skip to content

Commit 8225cca

Browse files
committed
Change for the file slug, use yoda condition
1 parent 22ef6ee commit 8225cca

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

inc/services/theme.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,22 @@ private function i18n() {
7272
* editor style
7373
*/
7474
private function editor_style() {
75+
/**
76+
* Default file
77+
**/
7578
$file = 'editor-style.css';
7679

77-
if ( ! defined( 'SCRIPT_DEBUG' ) || SCRIPT_DEBUG === false ) {
78-
$file = Framework::get_container()->get_service('assets')->get_min_file( 'editor-style.css' );
80+
if ( ! defined( 'SCRIPT_DEBUG' ) || false === SCRIPT_DEBUG ) {
81+
$file = Framework::get_container()->get_service( 'assets' )->get_min_file( 'editor-style' );
82+
}
83+
84+
/**
85+
* Do not enqueue a inexistant file on admin
86+
*/
87+
if ( ! is_file( get_theme_file_path( 'dist/assets/' . $file ) ) ) {
88+
return;
7989
}
8090

81-
add_editor_style( 'dist/assets/' . $file);
91+
add_editor_style( 'dist/assets/' . $file );
8292
}
8393
}

0 commit comments

Comments
 (0)