Git Product home page Git Product logo

Comments (9)

giannif avatar giannif commented on June 2, 2024 1

@maltoze it's possible, just most people use a bundler and it hasn't been on our roadmap. I'd have to add a umd file to our package.json and then it looks like you'd be able to use https://unpkg.com/ to grab the code in a script tag

from giphy-js.

giannif avatar giannif commented on June 2, 2024

@colorgold you can use the TypeScript Compiler

It's how we compile most of the code in this repo.

You'll just do:

tsc index.ts

Then the rest of the configuration comes from the tsconfig.json. Here is our tsconfig.json

from giphy-js.

colorgold avatar colorgold commented on June 2, 2024

@colorgold you can use the TypeScript Compiler

It's how we compile most of the code in this repo.

You'll just do:

tsc index.ts

Then the rest of the configuration comes from the tsconfig.json. Here is our tsconfig.json

Thank you for your response and patience. In my html file, do I reference the index.ts script or index.js? I copied the tsconfig.json you provided me with but I'm still having problems. For now I will go read the documentation on TypeScript Compiler to learn how to use it. Thanks again for the information.

from giphy-js.

giannif avatar giannif commented on June 2, 2024

@colorgold no problem! you'd reference the index.js from you html script src.

from giphy-js.

colorgold avatar colorgold commented on June 2, 2024

@colorgold no problem! you'd reference the index.js from you html script src.

I installed the TypeScript compiler but now I get a different error. This is what my code looks like:
image

image

If I remove the 2nd line in chat.js, I then get this error:
image

I don't know what I am doing wrong. I have read that putting a dummy var exports and var require works, but as expected, it did not load GIFs.

from giphy-js.

giannif avatar giannif commented on June 2, 2024

Ah I may have mislead you about tsc, we use that for our repo, but that is for our libraries, not for a bundle you'd use in a web page.

Take a look at https://parceljs.org/

It should be easy to get the bundled file you need for use with a script tag.

from giphy-js.

colorgold avatar colorgold commented on June 2, 2024

Ah I may have mislead you about tsc, we use that for our repo, but that is for our libraries, not for a bundle you'd use in a web page.

Take a look at https://parceljs.org/

It should be easy to get the bundled file you need for use with a script tag.

Would I still need tsc or do I get rid of all the js files created? I will go ahead and use parcel and see what happens. Thank you!

from giphy-js.

colorgold avatar colorgold commented on June 2, 2024

Thank you for recommending me Parcel. I was using webpack before and was getting so confused. So, the problem that I was having was that I was using my own server since I am also working with Firebase hosting. Parcel created a directory named dist, but my server serves files under my public directory; every time I ran my web app I got errors because the browser did not have access to the dist directory. I was able to catch my mistake by creating a new project in Visual Studio Code. I ran the project in the server that Parcel gave me and voila, the Giphy carousel loaded successfully. Now all I have to do is organize my original project.

Thank you so much for helping me and guiding me to solve my problem.

from giphy-js.

maltoze avatar maltoze commented on June 2, 2024

Ah I may have mislead you about tsc, we use that for our repo, but that is for our libraries, not for a bundle you'd use in a web page.

Take a look at https://parceljs.org/

It should be easy to get the bundled file you need for use with a script tag.

Why doesn't provide a version that can be used directly in <script>?

from giphy-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.