Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add main.css to the block editor #651

Draft
wants to merge 2 commits into
base: release/3.5.2
Choose a base branch
from
Draft
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
20 changes: 20 additions & 0 deletions inc/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ function generate_add_inline_block_editor_styles( $editor_settings ) {
return $editor_settings;
}

add_action( 'enqueue_block_assets', 'generate_add_editor_styles' );

/**
* Add CSS to the block editor to style blocks.
*
* @since 3.5.2
*/
function generate_add_editor_styles() {
$main_path = get_template_directory() . '/assets/css/main.css';

if( file_exists( $main_path ) ) {
wp_enqueue_style(
'generate-main',
get_theme_file_uri( 'assets/css/main.css' ),
'',
filemtime( $main_path )
);
}
}

add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' );
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' );
/**
Expand Down
Loading