[wp-trac] [WordPress Trac] #11315: Versioning is being forced for JavaScript and CSS assets with no override

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 3 16:35:59 UTC 2009


#11315: Versioning is being forced for JavaScript and CSS assets with no override
--------------------------+-------------------------------------------------
 Reporter:  amattie       |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  2.9       
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 It seems that there's currently no way to perform script and css resource
 versioning manually with wp_enqueue_script and wp_enqueue_style. When
 false, null, an empty string, or anything that evaluates to false is
 passed as the version argument, the version of WordPress is appended to
 the asset.

 This causes problems when trying to use wp_enqueue_script or
 wp_enqueue_style to manage assets on external web servers where something
 that is interpreted as a query string on a "normal" web server is
 interpreted as part of the asset name on that "special" web server. In my
 case, I'm trying to reference a script placed on Amazon S3 and served
 through their CloudFront CDN. I think a case can also be made where you
 don't want versioning on assets that you don't fully control. A good
 example of this is Google Maps, which I'm also using. Passing ?ver=2.9 to
 the Google Maps JavaScript loader could have unknown consequences in the
 future.

 My proposal is to skip the setting of the version in the query string for
 the asset if an empty string is passed in for that argument. The way I did
 this in my patch was by simply implementing strict type checking in a few
 key spots. This change leaves the default functionality in place while
 still providing a way for developers to override the version setting
 functionality.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11315>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list