jimaek/bootstrapcdn

Replace all CDN links with jsDelivr

Closed this issue · 26 comments

Replace all bootstrapcdn links with jsDelivr https://dl.dropboxusercontent.com/s/3eoqmd65vhfkdko/chrome_w0ZSG1bV4H.png

I think it would require a modification of this script https://github.com/MaxCDN/bootstrapcdn/blob/develop/scripts/integrity.js and integration with our API https://github.com/jsdelivr/data.jsdelivr.com

Also since the files are now dynamically pulled from the jsDelivr API, these files should also be deleted from the repo https://github.com/jimaek/bootstrapcdn/tree/develop/cdn

Also since the files are now dynamically pulled from the jsDelivr API, these files should also be deleted from the repo https://github.com/jimaek/bootstrapcdn/tree/develop/cdn

Got it, so the integrity script would completely change now. So I have to get all the cdn links from jsdelivr api and then display does instead.

Yes, and on top of that the automated tests would have to change as well. One of the key things they would have to check would be SRI consistency on top of everything else.
And have in mind that this script will also be used here #2 when the static becomes static. So its something that would only run during site building

For example, this is api to get package https://data.jsdelivr.com/v1/package do I need to get all existing packages that jsdeliver serves or only some specific?

Only the ones that are already supported by bootstrapcdn.com, check the code for the correct list.
Its something like bootstrap, fontawesome, bootswatch, bootlint

@jimaek paths to served files for cdn would be in dist folder? So something like bootstrap/5.0.0/dist/js/bootstrap.min.js only minified files? Also what else type of files need's to be included javascriptEsm, javascriptBundle?

jsDelivr handles the serving. This site will become just a place to copy URLs. Nothing will be hosted by this project.
So you need to completely remove the /cdn folder.

Yeah I get that, but now I need to create paths to the host with data from this api https://data.jsdelivr.com/v1/package/npm/bootstrap ?

https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css here that's how ur path looks like know, my question was we should only consider dist folder like in the link and only min version of the file since we get bunch of other files wiht api.

And btw host is cdn.jsdelivr.net?

Yes, base your logic on Bootstrap's docs to keep these projects consistent

cdn.jsdelivr.net

Yes, always

@jimaek Few questions regarding bootswatch and bootlint:

  • For bootswatch we have many versions but on the website we have only the latest I guess, so should we only show the latest version then?
  • And for bootlint some of the version in the list doesn't have same files as maxcdn versions. What I mean is, some of the version doesn't have bootlint.min.js file for instance but if I use default path I can use bootlint.js in that case sri is not the same as current maxcdn version?

Also, add me to contributors as well so I can push.

@jimaek Few questions regarding bootswatch and bootlint:

  • For bootswatch we have many versions but on the website we have only the latest I guess, so should we only show the latest version then?

yes

  • And for bootlint some of the version in the list doesn't have same files as maxcdn versions. What I mean is, some of the version doesn't have bootlint.min.js file for instance but if I use default path I can use bootlint.js in that case sri is not the same as current maxcdn version?

What do you mean? These look the same

https://cdn.jsdelivr.net/npm/bootlint@1.1.0/dist/browser/bootlint.min.js
https://stackpath.bootstrapcdn.com/bootlint/1.1.0/bootlint.min.js

Check the api for 0.16.1 and before It doesn't look like they have min.js on dist/browser path or I'm looking on wrong path?

Looks like they didn't publish min. But if we use only the latest version then it doesn't matter.

@jimaek we use latest version for bootswatch but for bootlint I think we need all?

The other thing looks good we just need to resolve this one and should be good to go

We can use non min version for now?

I would just ignore all old versions that dont qualify. Its not important

Can you take a look at the site, will need to make a few more optimization on the scripts but noting much. And one more note: I hardcoded the current version, for now because not I'm sure base on what criteria we should set this?

Can you take a look at the site,

Where? Open a PR here

Build fails it seems npm ERR! Cannot read property 'fetchSpec' of undefined

Moving discussion to that repo