타입스크립트와 Vite.js 번들러를 사용한 p5js 템플릿 코드.
A barebone p5.js template using TypeScript and Vite.js bundler.
- Node.js 설치가 필요하다.
- 터미널 앱에서 템플릿을 저장할 경로로
cd커멘드를 사용해서 이동해준다. git clone https://github.com/dizicoder/p5-template-ts.git또는gh repo clone dizicoder/p5-template-ts명령어를 실행한다.cd p5-template-ts명령어를 실행해서 폴더 안으로 이동한다.npm install명령어를 실행해서 필요한 패키지들을 설치한다.npm run dev명령어를 실행하면 로컬서버와 스케치가 실행된다.- 터미널에 표시된 URL을 브라우저에서 열어준다. 예:
http://localhost:5173. src/index.ts파일을 사용해서 스케치 코드를 작성한다.- 이미지 등의 외부파일은
public폴더에 넣어준다. npm install <name>명령어를 사용하면 추가로 필요한 패키지들을 설치할 수 있다.- 완성한 스케치는
npm run build명령어를 사용해서 웹에 올릴 파일을 만들어줄 수 있다.
- Node.js needs to be installed on your machine.
- in Terminal,
cdinto where you want to save the template. - Run
git clone https://github.com/dizicoder/p5-template-ts.gitorgh repo clone dizicoder/p5-template-ts. - Run
cd p5-template-ts. - Run
npm installto install the dependencies. - Run
npm run devto run the local server and the sketch. - Go to the URL displayed in the Terminal. ie.
http://localhost:5173. - Write your sketch code in
src/index.ts. - Use
publicfolder to store any external files such as images. - If you need to install additional NPM packages, Run
npm install <name>. - When you are ready to upload your sketch on the web, run
npm run buildto generate build files.