Skip to content

prjctimg/sketchbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

sketchbook

skchbk

Showcase your sketches hosted on GitHub Gists.

What does it allow you to do (features)?

  • Load and preview sketches (dynamically) via GitHub gists
  • Edit and run sketch code on-site
  • Show the used symbols in a sketch
  • Provide description for the sketch (useful for sharing references and the thought process)
  • Jump to the sketch's related gist

Note

Why not just use the p5 web editor?

This project is far from competing with the p5.js web editor for functionality (i.e., it doesn't have FES integration, etc.) but rather serves as an alternative approach to sharing your sketches in a more self-hosted fashion.

Also the motivation of this template was to reduce the moving parts between developing, publishing, and maintaining sketches so that any changes are trivial and kept at one 'source of truth'.

If you're looking to learn p5.js instead, please use the web editor as it has many more features geared towards that goal.

Configuration

Edit the sitemeta.json file to configure your sketchbook:

{
  "site": {
    "title": "skchbk",            // Site title (used in <title>)
    "description": "...",         // Meta description
    "url": "https://example.com"  // Deployed URL
  },
  "github": {
    "username": "your-github-username",
  },
  "ga": {
    "measurementId": ""  // Google Analytics 4 measurement ID (optional)
  }
}

How (why) does it work?

Each gist must contain a sketch.js file and optionally a p5.json file.

If the gist has a p5.json, the libs key is scraped for any installed p5 plugins and loads them via a CDN. Other dependencies outside of the p5.js scope are specified using a special comment with each name being a valid NPM package name (space or comma separated):

// deps: package1 package2

// OR 

//deps: package1,package2,...

Caution

Loading (big) modules can increase your sketch preview page's FCP as well as the page's RAM usage considerably. Pick the lightest dependency whenever possible.

The first GitHub comment on a gist (by the gist owner) becomes the sketch description. When that comment is updated (or the associated sketch.js and p5.json file), the changes are immediately mirrored on the sketchbook.

This allows the user to make edits to their sketches and not worry about redeploying for the changes to take effect.

Warning

Rendering is expensive.

If your sketch is making the preview page lag, do most work in setup(), lower frameRate(), or call noLoop() at the end of draw().

See Optimizing p5.js Code for Performance

Sketch format

All sketches must be in instance mode, global mode will not work.

This allows us to embed different sketches without creating any collisions with other JS libraries.

Tip

For more about why instance mode is preferred over global mode, see this article on the p5.js wiki

Other related references


License ๐Ÿ“œ

(c) 2026, prjctimg

This is free software, released under the GPL-3.0 license.



About

Showcase p5.js ๐ŸŒธ sketches hosted on GitHub gists ๐ŸŽ

Topics

Resources

Stars

Watchers

Forks

Contributors