Jump to content


Current best practice on importing GSAP?

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,


Know there are many posts about this, but things change overnight.


I am using Nuxt.js for Vue and have been playing around with a variety of ways to implement GSAP.


from Import, to vendor bundle, to plugin...


Wanted to know what everyone thinks is the best route to go these days knowing I like to include a lot of the extras!



Link to comment
Share on other sites

My personal opinion?


Libraries like GSAP: External CDN link with a fallback to a self-hosted version.

  • Like 1
Link to comment
Share on other sites

Thanks Dipscom,


Do you have an example of what this might look like with the fallback? CDN feels like the easiest solution so far!

Link to comment
Share on other sites

Remember that best practices are just opinions, and will change over time, but here's how to do a CDN fallback.


<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js"></script>
<script>window.TweenLite || document.write('<script src="js/TweenMax.min.js">\x3C/script>')</script>


  • Like 3
Link to comment
Share on other sites

Thanks guys!


I ended up creating a Vue plugin...

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.