From feeeb6d930042ee81dd9022b1a40fca4e2f1efc1 Mon Sep 17 00:00:00 2001 From: geeta102 Date: Fri, 13 Mar 2026 05:59:11 +0530 Subject: [PATCH 1/5] added discriptive CDN instruction to fownload page (#1229) --- src/content/text-detail/en/download.mdx | 22 +++++++++++++++++----- src/globals/globals.ts | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/content/text-detail/en/download.mdx b/src/content/text-detail/en/download.mdx index e0e90c3567..c3ed57e677 100644 --- a/src/content/text-detail/en/download.mdx +++ b/src/content/text-detail/en/download.mdx @@ -8,6 +8,7 @@ import { fullDownloadUrl, libraryDownloadUrl, minifiedLibraryDownloadUrl + p5LatestUrl } from '@src/globals/globals' Welcome! This page contains the links to start using p5.js in the way that suits you best. Open the p5.js Editor in your web browser, or download the library to your own computer. We’ve tried to order the links to reflect what a beginner might want first, then what a more experienced programmer may be looking for. @@ -30,11 +31,22 @@ These are downloads or links to the p5.js library file. No additional contents a p5.min.js -### Use p5.js from CDN -p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. +## Use p5.js from CDN + +All versions of p5.js are hosted on a content delivery network (CDN), a geographically distributed group of servers. There are a couple different ways to access the JavaScript library from your code editor. + +### Current Version of p5.js (recommended) + +Use the following URL if you'd like to access the current version of p5.js. {cdnLibraryUrl} -### Older versions -Looking for older versions? -Head over to GitHub for [earlier releases](https://github.com/processing/p5.js/releases) of p5.js. \ No newline at end of file +### Latest Version of p5.js + +Use the following URL if you'd like to ensure that you're always accessing the latest version of p5.js 2.x. + +{p5LatestUrl} + +### Other Versions of p5.js + +If you'd like to access an earlier version of p5.js, you can look up the corresponding URL on [p5.js' jsDelivr webpage](https://www.jsdelivr.com/package/npm/p5). diff --git a/src/globals/globals.ts b/src/globals/globals.ts index 4f3288744d..93861918c3 100644 --- a/src/globals/globals.ts +++ b/src/globals/globals.ts @@ -26,3 +26,5 @@ export const cdnSoundUrl = (!!import.meta.env?.PUBLIC_P5_LIBRARY_PATH || p5Version.startsWith('2')) ? `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}/dist/p5.sound.min.js` as const : `https://cdn.jsdelivr.net/npm/p5@${p5Version}/lib/addons/p5.sound.min.js` as const +export const p5LatestUrl = + `https://cdn.jsdelivr.net/npm/p5@2/lib/p5.min.js` as const; \ No newline at end of file From 7394d92342f4782ebbde385065ad803277e44e92 Mon Sep 17 00:00:00 2001 From: geeta102 Date: Fri, 13 Mar 2026 06:13:43 +0530 Subject: [PATCH 2/5] fixed the issue in import statement --- src/content/text-detail/en/download.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/text-detail/en/download.mdx b/src/content/text-detail/en/download.mdx index c3ed57e677..d7944d1fe7 100644 --- a/src/content/text-detail/en/download.mdx +++ b/src/content/text-detail/en/download.mdx @@ -7,7 +7,7 @@ import { cdnLibraryUrl, fullDownloadUrl, libraryDownloadUrl, - minifiedLibraryDownloadUrl + minifiedLibraryDownloadUrl, p5LatestUrl } from '@src/globals/globals' From 3269db5ae4eb1745de57ed6cefd3b7211c419cd4 Mon Sep 17 00:00:00 2001 From: geeta102 Date: Sun, 15 Mar 2026 07:10:05 +0530 Subject: [PATCH 3/5] fix: use dynamic p5Version for latest URL and description --- src/content/text-detail/en/download.mdx | 2 +- src/globals/globals.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/content/text-detail/en/download.mdx b/src/content/text-detail/en/download.mdx index d7944d1fe7..28cc3d6464 100644 --- a/src/content/text-detail/en/download.mdx +++ b/src/content/text-detail/en/download.mdx @@ -43,7 +43,7 @@ Use the following URL if you'd like to access the current version of p5.js. ### Latest Version of p5.js -Use the following URL if you'd like to ensure that you're always accessing the latest version of p5.js 2.x. +Use the following URL if you'd like to ensure that you're always accessing the latest version of p5.js {p5MajorVersion}.x. {p5LatestUrl} diff --git a/src/globals/globals.ts b/src/globals/globals.ts index 93861918c3..fd56cb3d82 100644 --- a/src/globals/globals.ts +++ b/src/globals/globals.ts @@ -26,5 +26,7 @@ export const cdnSoundUrl = (!!import.meta.env?.PUBLIC_P5_LIBRARY_PATH || p5Version.startsWith('2')) ? `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}/dist/p5.sound.min.js` as const : `https://cdn.jsdelivr.net/npm/p5@${p5Version}/lib/addons/p5.sound.min.js` as const +export const p5MajorVersion = + p5Version.split('.')[0] as const; export const p5LatestUrl = - `https://cdn.jsdelivr.net/npm/p5@2/lib/p5.min.js` as const; \ No newline at end of file + `https://cdn.jsdelivr.net/npm/p5@${p5Version.split('.')[0]}/lib/p5.min.js` as const; \ No newline at end of file From 70b2b47c4dfa91e96d68b5ff60987c7d35332ee0 Mon Sep 17 00:00:00 2001 From: geeta102 Date: Sun, 15 Mar 2026 07:28:29 +0530 Subject: [PATCH 4/5] removed unnecessary const --- src/globals/globals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/globals.ts b/src/globals/globals.ts index fd56cb3d82..47f62bbebd 100644 --- a/src/globals/globals.ts +++ b/src/globals/globals.ts @@ -27,6 +27,6 @@ export const cdnSoundUrl = ? `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}/dist/p5.sound.min.js` as const : `https://cdn.jsdelivr.net/npm/p5@${p5Version}/lib/addons/p5.sound.min.js` as const export const p5MajorVersion = - p5Version.split('.')[0] as const; + p5Version.split('.')[0]; export const p5LatestUrl = `https://cdn.jsdelivr.net/npm/p5@${p5Version.split('.')[0]}/lib/p5.min.js` as const; \ No newline at end of file From c366d89391feb5a2744d63949b206db97f31943b Mon Sep 17 00:00:00 2001 From: geeta102 Date: Sun, 15 Mar 2026 07:36:49 +0530 Subject: [PATCH 5/5] import p5MajorVersion in download.mdx --- src/content/text-detail/en/download.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/text-detail/en/download.mdx b/src/content/text-detail/en/download.mdx index 28cc3d6464..5db27a3e12 100644 --- a/src/content/text-detail/en/download.mdx +++ b/src/content/text-detail/en/download.mdx @@ -8,7 +8,8 @@ import { fullDownloadUrl, libraryDownloadUrl, minifiedLibraryDownloadUrl, - p5LatestUrl + p5LatestUrl, + p5MajorVersion } from '@src/globals/globals' Welcome! This page contains the links to start using p5.js in the way that suits you best. Open the p5.js Editor in your web browser, or download the library to your own computer. We’ve tried to order the links to reflect what a beginner might want first, then what a more experienced programmer may be looking for.