[buddypress-trac] [BuddyPress] #4949: Revise enqueue style locations for theme compat

buddypress-trac noreply at wordpress.org
Sun Jun 9 15:50:37 UTC 2013


#4949: Revise enqueue style locations for theme compat
-------------------------+------------------
 Reporter:  hnla         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  low          |   Milestone:  1.9
Component:  Theme        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+------------------
Changes (by boonebgorges):

 * keywords:  has-patch => needs-patch
 * milestone:  1.8 => 1.9


Comment:

 I like the idea of this ticket very much - we should be allowing the same
 fallbacks for assets like JS and CSS that we do for PHP template files.
 But I think we need to put a bit more thought into it than we have for
 1.8.

 Since 1.7, BP has used the notion of nested "template stacks" when looking
 for the appropriate template to serve. BP (and, optionally, other plugins)
 register certain potential template locations (such as child themes,
 parent themes, and bp-legacy) using `bp_register_template_stack`, and then
 in `bp_locate_template()` we loop through the registered locations to find
 the first matched template. This is a slick system, and is quite flexible.

 However, in order to do the very same logic for assets like JS and CSS
 files, we need to have two different template stacks: one for file paths
 (already in place for templates) and one for URIs. I've attached a very,
 very rough patch to see what that second stack could look like. But my
 patch is incomplete and won't work, because you need to have matched pairs
 of dir paths + URI paths in order to do the right kinds of checks.
 Something like:

 {{{
 foreach ( $template_locations as $template_location ) {
     if ( file_exists( $template_location['dir'] ) . $filename ) {
         $location = $template_location['url'];
         $handle = $template_location['asset-handle'];
     }
 }
 }}}

 So, we would need another layer of abstraction for registering template
 locations that includes the filesystem path *and* the URI path *and* some
 identifier for what kind of stack it is (parent theme, child theme, etc).

 I'm going to put this ticket in the 1.9 milestone so we can review
 possible solutions early on in that dev cycle.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4949#comment:3>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list