Gaweph / p5-typescript-starter

Base starter project using p5js and typescript
MIT License
344 stars 173 forks source link

How to deploy it to a server? #30

Closed wangzilinn closed 2 years ago

wangzilinn commented 2 years ago

First of all, thank you for the template project, I have written a game based on this project, but how can I deploy this code to my Nginx? Or to github page like you did?

Gaweph commented 2 years ago

Short answer (if you still have the default packages.json file)

npm start this will generate a file at build/build.js

Add this to your index.html using <script src="build/build.js"></script>

Thsi is exactly what I have done here https://github.com/Gaweph/p5-typescript-starter/blob/master/index.html

Gaweph commented 2 years ago

Don't forget - will also need a reference to https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js (or any version) in your html too

wangzilinn commented 2 years ago

Thank you very much for your help, I have followed your tutorial and deployed it successfully!