[theme-reviewers] Bundling libraries and prefixing
chip at chipbennett.net
Wed Mar 26 10:23:09 UTC 2014
In that case, breakage sounds like a feature rather than a bug. ;)
On Mar 26, 2014 2:26 AM, "Konstantin Kovshenin" <kovshenin at gmail.com> wrote:
> 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
> example :)
> 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', ... );
> >> vs
> >> wp enqueue_script( 'themename-nivo-slider', ... );
> >> Thanks!
> > 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.
> > -Otto
> > _______________________________________________
> > theme-reviewers mailing list
> > theme-reviewers at lists.wordpress.org
> > http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the theme-reviewers