I need to do this thing where I have to make a widget(interactable) in vanilla js and serve it via CDN. For serving, I was thinking of Google's Cloud CDN. The end goal is a modular widget that anyone can use via using a script tag. Does anyone has done this before? How did you approach it?
Asked
Active
Viewed 397 times
1 Answers
-1
This is definitely possible, but personally I just use npm for creating simple modular widgets since for simple widgets, a CDN's benefits aren't utilised. But yeah, it should be simple enough to serve a widget on a CDN and then include via a html script tag. All-in-all the CDN is essentially just a file hosting service that you can use to add javascript from the cloud, it's more or less the same as including jquery or any other library for that matter!

NeelD
- 73
- 9
-
I would love to do npm but I can't in this case. Also, for more info, the widget itself will be fetching data from some API's. It will be one solid widget, to be honest. Can you guide me about the project setup? That's my main concern since I haven't written vanilla js in a long time. – Pradhumna Pancholi Aug 13 '20 at 02:33
-
@Pradhumna Pancholi I don't understand what is your problem. You dont know how to make/load widget, or how to host it on cdn? – Antek Sep 30 '20 at 06:12