Using Sappers export feature to build a static site, I would love to be able to use JavaScript libraries like Conversational Form and GSAP. Trying to add them to client.js
or my components, I can't access the window
object.
How do I best approach this?
Sapper is a framework for building web applications of all sizes, with a beautiful development experience and flexible filesystem-based routing.
Svelte is a tool for building web applications that is an alternative to currently popular web frameworks like React, Vue, and Angular. Svelte is a web application compiler, not a library.
Server routes are Node-based API/REST services. Sapper supports implementing these and it hosts them so the client-side code can send requests to them. It enables collocating server-side code with client-side code in the same project.
The standard way is to import
those libraries into your components:
<script>
import { TweenMax, Power2, TimelineLite } from 'gsap';
export default {
oncreate() {
// use GSAP in here, or in custom methods
}
};
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With