Serves a local directory or file on port 8000 using Python's built-in HTTP server. Use this whenever you need to preview HTML files in the browser, especially for presentations, web apps, or any file that requires HTTP context (Google Fonts, JS modules, etc.). Kills any existing process on port 8000 before starting.
This skill starts a Python HTTP server on port 8000 so HTML files can be previewed in the browser at http://localhost:8000.
fuser -k 8000/tcp 2>/dev/null || true
nohup python3 -m http.server 8000 --directory "[TARGET_DIR]" > /tmp/http_server.log 2>&1 &
echo "Server PID: $!"
sleep 1 && curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/
http://localhost:8000/http://localhost:8000/[filename].html--directory to the folder containing the HTML file./tmp/http_server.log — check this if the server doesn't start.fuser -k 8000/tcp