[wp-trac] [WordPress Trac] #30289: Include GSAp in core
WordPress Trac
noreply at wordpress.org
Sat Nov 8 15:58:34 UTC 2014
#30289: Include GSAp in core
--------------------------------+------------------------------
Reporter: nikolay.yordanov | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: External Libraries | Version:
Severity: normal | Resolution:
Keywords: | Focuses: javascript
--------------------------------+------------------------------
Description changed by SergeyBiryukov:
Old description:
> GSAP (http://greensock.com/gsap) is a great library and it is pretty much
> the only way that you can reliably implement complex animations. Its
> usage is recommended in Google Developers/Web Fundamentals
> (https://developers.google.com/web/fundamentals/look-and-feel/animations
> /css-vs-javascript) and performs very well in comparisons to other
> animation approaches (http://greensock.com/js/speed.html).
>
> That said, using GSAP is WordPress is an absolute pain.
>
> GSAP is shipped as 19 separate files (you need a special license for
> another 5 plugins), and you can only bundle same-version files. You can
> see how this can get complicated very quickly - if one plugin includes a
> subset of the files from version 1.12, and another includes an
> intersecting subset of version 1.14 - neither plugin will work. Plugin
> authors can't reasonably expect that all other plugins will be updated in
> a timely manner.
>
> The only way to deal with this currently is for every plugin to sandbox
> whatever version of GSAP it needs. This means that every plugin using
> GSAP loads the same 30-50kB of JS, simply because they don't know whether
> there are any other plugins on the page which might use an old version.
>
> This could be solved by registering the 19 free GSAP files in WP core,
> thus giving plugin authors a reference version that they need to target.
> If you don't want to include the files in core, I'd suggest that their
> cdnjs-hosted versions can be used (https://cdnjs.com/libraries/gsap).
>
> ------------------
>
> What I am proposing is essentially a short-term fix. A better solution
> would involve rethinking the way WP handles JS, as discussed in these
> tickets:
>
> https://core.trac.wordpress.org/ticket/23285
> https://core.trac.wordpress.org/ticket/26113#comment:1
>
> Also, if there was some kind of a plugin-dependency system in place
> (#11308) or a concept of "library" plugins (https://wordpress.org/plugins
> /plugin-dependencies), there wouldn't be the need to put any of this in
> WP core. Plugins could just declare that they need the plugin which
> registers GSAP to be installed.
New description:
GSAP (http://greensock.com/gsap) is a great library and it is pretty much
the only way that you can reliably implement complex animations. Its usage
is recommended in Google Developers/Web Fundamentals
(https://developers.google.com/web/fundamentals/look-and-feel/animations
/css-vs-javascript) and performs very well in comparisons to other
animation approaches (http://greensock.com/js/speed.html).
That said, using GSAP is WordPress is an absolute pain.
GSAP is shipped as 19 separate files (you need a special license for
another 5 plugins), and you can only bundle same-version files. You can
see how this can get complicated very quickly - if one plugin includes a
subset of the files from version 1.12, and another includes an
intersecting subset of version 1.14 - neither plugin will work. Plugin
authors can't reasonably expect that all other plugins will be updated in
a timely manner.
The only way to deal with this currently is for every plugin to sandbox
whatever version of GSAP it needs. This means that every plugin using GSAP
loads the same 30-50kB of JS, simply because they don't know whether there
are any other plugins on the page which might use an old version.
This could be solved by registering the 19 free GSAP files in WP core,
thus giving plugin authors a reference version that they need to target.
If you don't want to include the files in core, I'd suggest that their
cdnjs-hosted versions can be used (https://cdnjs.com/libraries/gsap).
------------------
What I am proposing is essentially a short-term fix. A better solution
would involve rethinking the way WP handles JS, as discussed in these
tickets:
#23285
comment:1:ticket:26113
Also, if there was some kind of a plugin-dependency system in place
(#11308) or a concept of "library" plugins (https://wordpress.org/plugins
/plugin-dependencies), there wouldn't be the need to put any of this in WP
core. Plugins could just declare that they need the plugin which registers
GSAP to be installed.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30289#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list