Olian04 / github-readme

A custom element that renders the readme of a github repository
https://olian04.github.io/github-readme/
MIT License
17 stars 3 forks source link

Migrate history.min.js cdn from unpkg to cdnjs #2

Closed Richienb closed 5 years ago

Olian04 commented 5 years ago

Thank you for the PR! May i ask why you think we should use cdnjs over unpkg?

Richienb commented 5 years ago
  1. Cdnjs is much faster than unpkg
  2. Decrease cross domain fetches
  3. Stops unexpected behaviour caused by versions changing
Olian04 commented 5 years ago
  1. Cdnjs is much faster than unpkg

Do you have any statistics to back that up? Because according to unpkg: "The fast, global infrastructure that powers unpkg is generously donated by Cloudflare".

  1. Decrease cross domain fetches

Why is this an issue? Each asset is fetched individually either way, are they not?

  1. Stops unexpected behaviour caused by versions changing

True, the version should be locked down. But this can be done with unpkg as well, like this: unpkg.com/:package@:version. (I'll actually go ahead and fix this right away)

Richienb commented 5 years ago

Do you have any statistics to back that up? Because according to unpkg: "The fast, global infrastructure that powers unpkg is generously donated by Cloudflare".

Cdnjs is CloudFlare. It is the only one on the CloudFlare blog.

Why is this an issue? Each asset is fetched individually either way, are they not?

This is how a request is usually handled by a browser in the old code:

  1. Connect to cdnjs
  2. Load files
    1. showdown.min.js
    2. github-markdown.min.css
  3. Connect to unpkg
  4. Load files
    1. history.min.js

This is how a request can be handled by making all the cdn urls the same:

  1. Connect to cdnjs
  2. Load files
    1. showdown.min.js
    2. github-markdown.min.css
    3. history.min.js
Olian04 commented 5 years ago

Alright, you've convinced me.