[wp-trac] [WordPress Trac] #31281: Register JavaScript/Underscore templates using the WP Dependency API

WordPress Trac noreply at wordpress.org
Sun Jan 3 08:07:50 UTC 2016


#31281: Register JavaScript/Underscore templates using the WP Dependency API
---------------------------+------------------------------
 Reporter:  F J Kaiser     |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by ChriCo):

 Heyho.

 1. I think this solution can provide some more benefits to the script
 -/style-management in WordPress. Think about the use case for "above the
 fold styles" or the inline script/styles for emoji's, or the new
 WordPress-Embed-Script which is inline too.

 2. The DOMDocument only works, if we delivery valid HTML and works with
 UTF-8 encoding. Hm...maybe you don't need the DOMDocument to create inline
 scripts - see {{{wp_localize_script()}}} which just echos the script tag.

 --

 Some hosting providers are not allowing {{{file_get_contents()}}} via
 http, so we have to replace this:

 {{{#!php
 <?php
 str_replace( get_home_url( ) . '/', ABSPATH, $src );
 }}}

 --

 Another solution could be, to add a new function to load script_templates
 with some filters - something like {{{get_script_template( $name );}}}.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31281#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list