[wp-trac] [WordPress Trac] #46379: REST API posts/pages response to include scripts needed for display of post content

WordPress Trac noreply at wordpress.org
Thu Feb 28 19:11:35 UTC 2019


#46379: REST API posts/pages response to include scripts needed for display of post
content
--------------------------+-----------------------------
 Reporter:  mnelson4      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Often post body is dependent on external scripts and stylesheets in order
 to be displayed correctly, but there is no way to discover what those
 scripts/stylesheets are.
 This problem was encountered in Gutenberg on
 https://github.com/WordPress/gutenberg/pull/9734, and the fix was to
 filter the REST API response to include the list of scripts.

 You can't know what the scripts are required ahead of time, especially if
 the API client code is being run from a different server. Shortcodes and
 Gutenberg blocks can dynamically add scripts and stylesheets.

 So, I think the problem is three-fold:

 1. How to detect what scripts/stylesheets are required to display a
 particular page/post body
 2. How to return that information over the REST API
 3. How can API clients (like the backbone client) use that to display the
 post's body correctly (with the required javascript/stylesheets)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46379>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list