retug
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by retug
-
-
Thanks for the reply Jack.
"Is there a reason you're not just loading the regular minified files (like gsap.min.js) from the CDN via a standard <script src="..."></script> tag? "
There is not, total beginner here and appreciate you pointing me in the right direction.
I want to follow the method you have outline above, how do I reference the script tag in my .js file? (sorry, I am sure this is a super beginner question)
html :
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"></script>
javascript (not sure what the import should look like):
import { gsap } from 'gsap'
Thanks!
-
Total beginner here, followed a tutorial online that used gsap with an NPM install and now I want to push my code up to my website and I am running into some errors.
I have the following html code:
<script type="importmap">
{
"imports": {
"three" : "https://unpkg.com/three@0.126.1/build/three.module.js",
"orbitcontrols" : "https://unpkg.com/three@0.126.1/examples/jsm/controls/OrbitControls.js",
"datgui" : "https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.9/dat.gui.min.js",
"gsap" : "https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"
}
}
</script>
<script type="module" src="{% static 'blog/threeBackground.js' %}"></script>This is then imported in my .js file as follows:
import * as THREE from 'three';
import { OrbitControls } from 'orbitcontrols';
import * as dat from 'datgui';
import { gsap } from 'gsap';Upon running my dev server, I get the following error:
Uncaught SyntaxError: The requested module 'gsap' does not provide an export named 'gsap'
I did some googling and found this similar topic, but I still can't seem to figure out what is wrong with my code.
I have tried moving the gsap import out and into its own script tag with a type = "module" tag as it appears was suggested, but that was throwing some errors as well. Any thoughts on how to solve would be much appreciated!
Thanks!
GSAP with CDN
in GSAP
Posted
Wow, thank you! I was making this very difficult.