Editor style doesn't load on chrome 70.0.35 Centos 7
Describe the bug My editor-style.css file doesn't load when in Chrome on centOS 7. It works fine in Chrome on macOS
To Reproduce Steps to reproduce the behavior:
- Add editor style sheet:
function theme_block_editor_styles() {
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue editor styles.
add_editor_style( get_theme_file_uri( '/style-editor.css' ) );
}
add_action( 'after_setup_theme', 'theme_block_editor_styles' );
- make background black or something and load editor
- editor style is not loaded. Insead I get this error:
"Error while traversing the CSS: TypeError: e.slice is not a function" in http://sitename/wp-content/plugins/gutenberg/build/editor/index.js?ver=1542353313
Desktop (please complete the following information):
- OS: centOS 6
- Browser Chrome 70.0.35
Additional context GB 4.4
I changed how I loaded the editor style today from:
function theme_block_editor_styles() {
wp_enqueue_style( 'theme-block-editor-styles', get_theme_file_uri( '/style-editor.css' ), false, '1.0', 'all' );
}
add_action( 'enqueue_block_editor_assets', 'theme_block_editor_styles' );
Loading it this way works on both macOS and centOS but doing it the correct way I described at the top of this posts fixed a bunch of other issues so I prefer not rolling back to the old way.
Is there anything more I can do to help with testing ? I’m very keen on fixing this but the console error isnt really helpful. I tried disabling all plugins and with a new editor stylesheet with just
body { color: #551516; }
with the same result (working prefectly on mac and not at all on linux)
Fixed it, the get_theme_file_uri doesn't seem to work in this case or something:
function theme_block_editor_styles() { // Add support for editor styles. add_theme_support( 'editor-styles' ); // Enqueue editor styles. add_editor_style('/style-editor.css');
}
add_action( 'after_setup_theme', 'theme_block_editor_styles' );
Happens using get_template_directory_uri() too.
Worked fine locally but got the traversing error on server.
That's an hour of my life I'm never getting back 😭