Make WordPress Core

Opened 5 years ago

Last modified 2 years ago

#45741 new enhancement

Theme block style dependencies while enqueuing

Reported by: superpoincare's profile superpoincare Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version: 5.0.2
Component: Bundled Theme Keywords: needs-patch
Focuses: css Cc:


Bundled themes enqueue a block style, such as /css/blocks.css in twentytwelve.

These css rules sometimes overwrite the rules in the files with handles wp-block-library and wp-block-library-theme

While the dependencies seem to be maintained, for the sake for completeness, shouldn't dependencies be made explicit in bundled themes' functions.php files?

For example, dependencies in this enqueue?

wp_enqueue_style( 'twentytwelve-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentytwelve-style' ), '20181018' );

Change History (1)

#1 @sabernhardt
2 years ago

  • Focuses css added
  • Keywords needs-patch added

Thanks for the report!

The 'wp-block-library-theme' styles can be added inline, so that could be tricky (if listing that one is necessary).

After finding an issue with the stylesheet sequence on #54076, adding 'wp-block-library' should be worth exploring with Twenty Twelve to Twenty Seventeen.

wp_enqueue_style( 'twentytwelve-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'wp-block-library', 'twentytwelve-style' ), '20190406' );
Note: See TracTickets for help on using tickets.