···11+# Folder structure
22+33+- `src` - source code for your kaplay project
44+- `dist` - distribution folder, contains your index.html, built js bundle and static assets
55+66+77+## Development
88+99+```sh
1010+$ bun run dev
1111+```
1212+1313+will start a dev server at http://localhost:8000
1414+1515+## Distribution
1616+1717+```sh
1818+$ bun run build
1919+```
2020+2121+will build your js files into `dist/`
2222+2323+```sh
2424+$ bun run zip
2525+```
2626+2727+will build your game and package into a .zip file, you can upload to your server or itch.io / newground etc.
···11+import kaplay from "kaplay";
22+// import "kaplay/global"; // uncomment if you want to use without the k. prefix
33+44+const k = kaplay();
55+66+k.loadRoot("./"); // A good idea for Itch.io publishing later
77+k.loadSprite("bean", "sprites/bean.png");
88+99+k.add([k.pos(120, 80), k.sprite("bean")]);
1010+1111+k.onClick(() => k.addKaboom(k.mousePos()));
+37
vite.config.js
···11+import { defineConfig } from "vite";
22+33+const kaplayCongrats = () => {
44+ return {
55+ name: "vite-plugin-kaplay-hello",
66+ buildEnd() {
77+ const line =
88+ "---------------------------------------------------------";
99+ const msg = `🦖 Awesome pal! Send your game to us:\n\n💎 Discord: https://discord.com/invite/aQ6RuQm3TF \n💖 Donate to KAPLAY: https://opencollective.com/kaplay\n\ (you can disable this msg on vite.config)`;
1010+1111+ process.stdout.write(`\n${line}\n${msg}\n${line}\n`);
1212+ },
1313+ };
1414+};
1515+1616+export default defineConfig({
1717+ // index.html out file will start with a relative path for script
1818+ base: "./",
1919+ server: {
2020+ port: 3001,
2121+ },
2222+ build: {
2323+ // disable this for low bundle sizes
2424+ sourcemap: true,
2525+ rollupOptions: {
2626+ output: {
2727+ manualChunks: {
2828+ kaplay: ["kaplay"],
2929+ },
3030+ },
3131+ },
3232+ },
3333+ plugins: [
3434+ // Disable messages removing this line
3535+ kaplayCongrats(),
3636+ ],
3737+});