CDN
Zenahr opened this issue · 6 comments
Any option to use the library via CDN or as a minified JS file? (in other words: non-NPM setups)
@Zenahr Hi, been wanting to explore this but haven't gotten around to it.
You could use unpkg, which would provide unminified UMD build (2.9k):
https://unpkg.com/lunarphase-js@1.0.10/dist/browser/lunarphase-js..js
Let me see if I can provider something better in the near future.
Going to reopen this as a reminder to complete this task - I've been meaning to do this for some time.
Found my way here as well since I was hoping to use the library but am also in a more barebones environment without access to NPM.
@marcthayer Hi, yeah - haven't worked on this, but I think the unpkg works in a script tag?
https://unpkg.com/lunarphase-js@1.0.10/dist/browser/lunarphase-js..js
@marcthayer Oh, the version updated as of 2x you would target:
- IIFE: https://unpkg.com/lunarphase-js@2.0.1/dist/index.iife.js
- CJS: https://unpkg.com/lunarphase-js@2.0.1/dist/index.cjs.js
- ES: https://unpkg.com/lunarphase-js@2.0.1/dist/index.es.js
- UMD: https://unpkg.com/lunarphase-js@2.0.1/dist/index.umd.js
And corresponding maps should be there as well, for example with IIFE:
Does that work for you?
Usage with esm.sh:
import { Moon } from "https://esm.sh/lunarphase-js";
Moon.lunarAge();