WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30289 closed feature request (wontfix)

Include GSAp in core

Reported by: nikolay.yordanov Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: External Libraries Keywords:
Focuses: javascript Cc:

Description (last modified by SergeyBiryukov)

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.

Change History (3)

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#2 @helen
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

We typically do not bundle libraries that we do not use (there are some leftovers from old days here and there), and more importantly, the chances of their license being compatible with ours appear to be close to zero. Cool library, though.

#3 @jorbin
5 years ago

The license (http://greensock.com/standard-license) is definitely not GPL compatible. Section II, point A states:

"You agree that you will not sell, rent, or license the PROGRAM's source code or any derivative works thereof to any third party without the prior written consent of GREENSOCK. Distribution of the PROGRAM as part of your Developed Work is acceptable so long as it is used exclusively as a part of your Developed Work. You agree not to modify or delete GREENSOCK'S existing copyright notices located in the source code."

Note: See TracTickets for help on using tickets.