[wp-trac] [WordPress Trac] #31281: Register JavaScript/Underscore templates using the WP Dependency API
WordPress Trac
noreply at wordpress.org
Sun Feb 15 05:17:40 UTC 2015
#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: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by rmccue):
The patch here needs to be in 5.2 syntax, so no `\`s in the class names
please. Also, needs to follow WP bracing style. :)
Also, as I noted on #31273, I think it'd be more valuable to allow just
adding arbitrary HTML to tags via `WP_Dependencies::add_data`.
Alternatively, a different dependency chain should be used rather than
attaching this on top of the WP_Scripts one.
I'm thinking something like...
{{{
wp_script_add_data( 'handle', '<script type="text/x-javascript-hbs" id
="tmpl-xyz">{{ this.title }}</script>' );
}}}
It's then trivial to allow Backbone/Underscore-style templating, as well
as anything else you want to achieve (meta tags, etc).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31281#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list