Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Daniel Hult

Treeshaking gsap core

Recommended Posts

Hi!

Is it possible to treeshake things from the core that you dont use? Like utility functions and eases e.g.

Link to comment
Share on other sites

Not really. The only thing you can do is rip out CSSPlugin completely from the core, but I doubt you want to do that. It's only useful if you don't animate any DOM elements. The utility methods are mostly things that are already being used deep in the guts of the engine, so we exposed them for convenience. It's not like they're just fluff. 

 

If we wrote everything in a way that's solely focused on tree shaking, it would actually make the engine quite a bit larger and more cumbersome to use. For example, the eases leverage common builder functions that significantly reduce the code necessary. Separating and isolating them all (for tree shaking) would probably triple the code. And of course it'd force you to import each ease whenever you want to use one (instead of using the convenient strings). See what I mean? 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×