Skip to content

Commit 3269db5

Browse files
geeta102doradocodes
authored andcommitted
fix: use dynamic p5Version for latest URL and description
1 parent 7394d92 commit 3269db5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/content/text-detail/en/download.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Use the following URL if you'd like to access the current version of p5.js.
4343

4444
### Latest Version of p5.js
4545

46-
Use the following URL if you'd like to ensure that you're always accessing the latest version of p5.js 2.x.
46+
Use the following URL if you'd like to ensure that you're always accessing the latest version of p5.js {p5MajorVersion}.x.
4747

4848
<CodeContainerWithCopy>{p5LatestUrl}</CodeContainerWithCopy>
4949

src/globals/globals.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ export const cdnSoundUrl =
2626
(!!import.meta.env?.PUBLIC_P5_LIBRARY_PATH || p5Version.startsWith('2'))
2727
? `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}/dist/p5.sound.min.js` as const
2828
: `https://cdn.jsdelivr.net/npm/p5@${p5Version}/lib/addons/p5.sound.min.js` as const
29+
export const p5MajorVersion =
30+
p5Version.split('.')[0] as const;
2931
export const p5LatestUrl =
30-
`https://cdn.jsdelivr.net/npm/p5@2/lib/p5.min.js` as const;
32+
`https://cdn.jsdelivr.net/npm/p5@${p5Version.split('.')[0]}/lib/p5.min.js` as const;

0 commit comments

Comments
 (0)