[theme-reviewers] Bundling libraries and prefixing
kovshenin at gmail.com
Wed Mar 26 06:26:55 UTC 2014
Here's a follow-up question.
Given that a theme has used a non-prefixed generic name for a bundled
script, how could we ensure it doesn't break when core introduces the
same handle but with a different version? Masonry v3 in 3.9 for
On Thu, Feb 27, 2014 at 9:13 PM, Otto <otto at ottodestruct.com> wrote:
> On Thu, Feb 27, 2014 at 8:32 AM, Konstantin Kovshenin
> <kovshenin at gmail.com> wrote:
>> Quick question.
>> If a theme bundled the Twitter Bootstrap library, or Nivo Slider, or
>> jQuery Colorbox, should it prefix the wp_enqueue_script/style handles
>> with the theme name, or should it use a generic name?
>> wp_enqueue_script( 'nivo-slider', ... );
>> wp enqueue_script( 'themename-nivo-slider', ... );
> The first one.
> Prefixing is intended to provide separation. However, the ID in this
> case is intended to make sure that the script is only loaded once. If
> both the theme and a plugin used the same name for the same script,
> then the script would still load once, properly.
> The handle of the script should be based on the name of the script. If
> it's custom to the theme, then prefix it. If it's a generic script
> that comes from elsewhere, then choose the most obvious handle for it.
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
More information about the theme-reviewers