mirror of
https://github.com/acamarata/moon-cycle.git
synced 2026-06-30 18:54:29 +00:00
1.2 KiB
1.2 KiB
moon-cycle / cdnUrl
Function: cdnUrl()
cdnUrl(
filename,set,size,quality,ref?):string
Defined in: helpers.ts:36
Returns a jsDelivr CDN URL for a specific moon image.
jsDelivr serves files directly from GitHub repositories, making it a practical option for web applications that need the images without bundling ~438 MB of assets locally.
Parameters
filename
string
Filename returned by cycleMonth or cycleYear, e.g. "354.webp".
set
Image set: 'mm' (monthly) or 'my' (yearly).
size
Image dimension: 256 or 512.
quality
WebP quality: 75 or 85.
ref?
string = 'main'
Git ref (branch, tag, or commit SHA). Defaults to 'main'.
Returns
string
A full CDN URL string.
Example
const file = cycleMonth();
const url = cdnUrl(file, 'mm', 256, 75);
// => 'https://cdn.jsdelivr.net/gh/acamarata/moon-cycle@main/mm-256-75/354.webp'