mkp5 banner image

mkp5

logo for /logos/svg/logo-github.svg
View on GitHub

Initialize a p5.js project from the command line! 🐦

This script creates all the necessary files for a p5.js project, including an index.html, sketch.js, and style.css file. You can choose a directory to create the p5 project in (default: current directory, aka .), and the name of the sketch (default: sketch).

Quick Start šŸš€

curl -O https://raw.githubusercontent.com/codevogel/mkp5/refs/heads/main/mkp5
chmod +x mkp5
./mkp5 [directory] [sketch name]

Installation and Usage šŸ”§

ā„¹ļø This assumes you are running Linux or Windows Subsystem for Linux (WSL).

  1. git clone this repository, or download the mkp5 file directly.

  2. Make the file executable:

chmod +x the/path/to/mkp5
  1. (Optional): Add the file to your PATH. For example, when using bash:
echo "export PATH=\$PATH:/the/path/to/mkp5" >> ~/.bashrc

Don't forget source your .bashrc (or simply restart your terminal).

source ~/.bashrc
  1. If you completed step 3, you can now run mkp5 from anywhere!
mkp5 [directory] [sketch name]

If you didn't complete step 3, you can run the script like this:

/the/path/to/mkp5 [directory] [sketch name]

(Note that if you did not complete step 3, and are trying to run mkp5 from the current directory, you'll have to prepend ./ to the script name.)

./mkp5 [directory] [sketch name]

Examples šŸ“™

mkp5

Creates index.html, sketch.js, and style.css files in the current directory.

mkp5 my-p5-project

Creates index.html, sketch.js, and style.css files in ./my-p5-project

mkp5 my-p5-project my-sketch

Creates index.html, my-sketch.js, and style.css files in ./my-p5-project

Contributing šŸ¤

Feel free to fork this repository and submit a PR if you have any improvements, features or bug fixes!