← Back to SKILL.md1#!/bin/bash2# p5.js Skill — Local Development Server3# Serves the current directory over HTTP for loading local assets (fonts, images)4#5# Usage:6# bash scripts/serve.sh [port] [directory]7#8# Examples:9# bash scripts/serve.sh # serve CWD on port 808010# bash scripts/serve.sh 3000 # serve CWD on port 300011# bash scripts/serve.sh 8080 ./my-project # serve specific directory12 13PORT="${1:-8080}"14DIR="${2:-.}"15 16echo "=== p5.js Dev Server ==="17echo "Serving: $(cd "$DIR" && pwd)"18echo "URL: http://localhost:$PORT"19echo "Press Ctrl+C to stop"20echo ""21 22cd "$DIR" && python3 -m http.server "$PORT" 2>/dev/null || {23 echo "Python3 not found. Trying Node.js..."24 npx serve -l "$PORT" "$DIR" 2>/dev/null || {25 echo "Error: Need python3 or npx (Node.js) for local server"26 exit 127 }28}29