Jump to content
GreenSock

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

Any tips on updating scripts url as we get new version of GSAP

Go to solution Solved by OSUblake,

Recommended Posts

this is how i do on my websites, i add cloudflare gsap url for gsap and scrolltrigger at the end before closing of </body>.

what i need suggestions is as we get new updates on gsap i goto my old websites and folders and manually do change on each html pages like "gsap/3.8.0/gsap.min.js" to "gsap/3.9.0/gsap.min.js"

is there any better way of doing it like is there any URL link which automatically get updated or they always have updated GSAP script urls inbuilt something like that.

<!DOCTYPE html>
<html lang="en">
 
<head>
  <title>GSAP</title>
</head>
 
<body>
 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.0/gsap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.0/ScrollTrigger.min.js"></script>
 
</body>
 
</html>
Link to comment
Share on other sites

  • Solution

There's a couple other CDNs that will let you grab the latest like this.

<script src="https://unpkg.co/gsap@3/dist/gsap.min.js"></script>
<script src="https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js"></script>

 

However, I would use caution doing that as you don't know if a new version might cause something to break. It's best to fully test when you change a version.

 

And another problem with the getting the latest version like that is that it requires an extra http request, so it adds extra loading time.

  • Like 2
Link to comment
Share on other sites

Yep, and jsdelivr offers the same feature, like: 

https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js

 

Notice the /@3/ part - you can specify a major, minor, or patch release:

 

/@3/ = latest version 3 (major)

/@3.9/ = only the latest patch of 3.9.x

/@3.9.1/ = only this one particular version (3.9.1)

 

See https://www.jsdelivr.com/package/npm/gsap

  • Like 2
Link to comment
Share on other sites

thank you @OSUblake and @GreenSock for clarifying using script url and yes we should test the latest version is working fine then use it. thank you so much again.

 

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.
×