Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
JTDev

GSAP JS APIs & file sizes

Recommended Posts

I'm currently using TweenMax.min.js. I need to do some file size crunching for a banner I'm working on. I've loaded the following files which saves me about 21KB instead of using TweenMax.min.js (90KB).

 

 

<script type="text/javascript" src="plugins/CSSPlugin.min.js"></script>
<script type="text/javascript" src="easing/EasePack.min.js"></script>
<script type="text/javascript" src="TweenLite.min.js"></script>
<script type="text/javascript" src="TimelineLite.min.js"></script>
 
Here are my questions:

 

1. Is there anything else I can do to further reduce the overall file size?

 

2. I didn't experiment yet but can I move the CSSPlugin and EasePack files into the root with TweenLite and TimelineLite?

 

3. Do the files need to load in a specific order?

 

Link to post
Share on other sites

Hi and welcome to the GreenSock forums.

 

There really isn't much else you can do unless you want to get your hands real dirty. Its possible you could open up the uncompressed versions, rip out any functions you don't need, and then re-minify them, I'm really not sure how much you can save that way though.

 

It might be easy to rip out the eases you aren't using, but there isn't much you could save there... maybe 2-3kb.

 

I hate to say it, but cutting TimelineLite will probably give you the biggest gain with least work. 

 

I'm curious though, what ad network are you creating the banner for? What are the filesize restrictions?

 

I'm asking because we are working very closely with some folks that are creating an HTML5 banner spec that networks can use as a guide. We and you have been given a unique opportunity to voice concerns and make suggestions regarding the spec. It looks like there is hope for networks being a bit more tolerant with file size. Read more here:

http://forums.greensock.com/topic/7781-js-size-in-kbs-dont-match/#entry29641

 

Back to your question, the order in which the files load doesn't really matter.

Link to post
Share on other sites

Thanks, that's what I figured but wanted to confirm.


 


Regarding file sizes, the banner is for a website and I'm just trying to optimize as much as I can. There really are no restrictions.


 


Nice job on the library, this saved me a lot of time!


  • Like 1
Link to post
Share on other sites

I would definitely combine the 4 files together to speed up your download. Just cut and paste into 1 file.

  • Like 1
Link to post
Share on other sites

Combining them is technically faster, but you lose any possibility of the files being cached already. I recommend using the CDN, which may deliver them faster than your web host, which would make it your fastest option of all. Although, it's only like 30kb gzip'd, which is nothing. Even at 90kb, loads fast even on my phone. If your website is slow, then I don't think gsap is your biggest problem. But I always prefer CDN first, and serve local copies only if the CDN fails. jQuery is a perfect test case, because more often than not they already have it cached off a CDN, which is an instant 100k savings. The more websites that adopt this strategy, the more we all benefit

  • Like 1
Link to post
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.

×