feat: add stdlib and browser examples
- stdlib/html.lux: Type-safe HTML construction - stdlib/browser.lux: Browser utilities - examples/web/: Counter app with DOM manipulation - examples/counter.lux: Simple counter example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
26
examples/web/serve.sh
Executable file
26
examples/web/serve.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Simple HTTP server for testing Lux web examples
|
||||
# Usage: ./serve.sh [port]
|
||||
|
||||
PORT=${1:-8080}
|
||||
DIR="$(dirname "$0")"
|
||||
|
||||
echo "Serving Lux web examples at http://localhost:$PORT"
|
||||
echo "Open http://localhost:$PORT/index.html in your browser"
|
||||
echo "Press Ctrl+C to stop"
|
||||
echo ""
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
# Try python3 first, then python, then node
|
||||
if command -v python3 &> /dev/null; then
|
||||
python3 -m http.server $PORT
|
||||
elif command -v python &> /dev/null; then
|
||||
python -m SimpleHTTPServer $PORT
|
||||
elif command -v npx &> /dev/null; then
|
||||
npx serve -p $PORT .
|
||||
else
|
||||
echo "Error: No suitable HTTP server found."
|
||||
echo "Install Python or Node.js to serve files."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user