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 core block stylesheets to Reader mode template #4204

Closed
westonruter opened this issue Jan 30, 2020 · 2 comments · Fixed by #4299
Closed

Add core block stylesheets to Reader mode template #4204

westonruter opened this issue Jan 30, 2020 · 2 comments · Fixed by #4299
Labels
CSS P0 High priority QA passed Has passed QA and is done
Milestone

Comments

@westonruter
Copy link
Member

westonruter commented Jan 30, 2020

Feature description

When blocks are added to post content they can appear very poorly in Reader mode. The reason for this is the block styles from core are not being included in the template. Before #2202 this was not feasible to do due to the lack of tree shaking, but now that it is resolved this is no longer the case.

The Reader mode templates should be made fully block-compatible by including the wp-block-library stylesheet in the template. What's more is that the templates should behave as if current_theme_supports( 'wp-block-styles' ) so that wp-block-library-theme is also added. In fact, the Reader mode templates should probably go ahead and call wp_common_block_scripts_and_styles() so that the enqueue_block_assets action is triggered. Any stylesheet that is enqueued as part of that should then get printed.

Related: #2044


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

The basic implementation can look like this:

--- a/templates/html-start.php
+++ b/templates/html-start.php
@@ -40,6 +40,7 @@
 	<style class="style-template-part">
 		<?php $this->load_parts( [ 'style' ] ); ?>
 	</style>
+	<?php wp_print_styles( [ 'wp-block-library', 'wp-block-library-theme' ] ); ?>
 	<style class="amp-post-template-css-action">
 		<?php
 		/**

QA testing instructions

  • Create a new post in the block editor
  • Add a "Cover" block
  • Upload an image to the Cover block
  • Set the alignment of the Cover block to "Full Width"
  • Configure the AMP plugin to use the "Reader" Mode
  • Visit to the AMP URL of the newly created post
  • Verify: The Cover block that was added spans the entire width of the site and adjusts to the page while resizing.

Demo

Changelog entry

@westonruter
Copy link
Member Author

Fixed via #4299.

@csossi
Copy link

csossi commented Feb 20, 2020

Verified in QA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS P0 High priority QA passed Has passed QA and is done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants