Jump to content
Search Community

How to include plugins in Vue

Daniel Hult test
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

Hey,

Im making a site with Vue and Nuxt and Im using gsap from node modules. In have problems loading the plugins I've bought from a folder.
If I want to use e.g ScrollTo plugin - I've tried putting the minified script in a folder and then using it, but it throws me an error that it can't find TweenLite. How would I solve this?

Link to comment
Share on other sites

Hm, if you're using a build system like that, I assume it'd be best to use the ES module files rather than the minified files. ScrollToPlugin is in the NPM package, FYI. So you should be able to just npm install gsap and then: 

import ScrollToPlugin from "gsap/ScrollToPlugin.js"

const plugins = [ScrollToPlugin]; //just to reference it so that tree shaking doesn't dump it in your build process

 

  • Like 2
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.
×
×
  • Create New...