[theme-reviewers] Bundling libraries and prefixing

Chip Bennett 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
>
>
>
> --
> Konstantin
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140326/76c00f70/attachment.html>


More information about the theme-reviewers mailing list