Dhana Krishnasamy
Dhana Krishnasamy

Reputation: 2176

How do I add arbitrary javascript files from GitHub in jsFiddle?

I know jsFiddle used to support arbitrary javascript files from GitHub, but not anymore. May be GitHub has changed its mime type of raw files. what are the alternatives when the required js files is not in any cdn (may be its less popular js repo).

Upvotes: 8

Views: 1512

Answers (1)

Tengiz
Tengiz

Reputation: 8449

It's an old question I see, but still I've found the answer:

  1. Get the Raw URL of the Github file you need to include. e.g. you will have https://raw.github.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
  2. Remove the dot (.) between "raw" and "github" and use that resulting url in the jsfiddle. e.g. you will end up having https://rawgithub.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css that works just perfect in jsfiddle.

Why this works? because of the rawgithub.com service that serves the content with the correct MIME type.

And obviously, credits to http://www.geekdave.com/2013/06/19/linking-raw-github-files-from-jsfiddle/ where I actually found the answer I needed.

Cheers!

Upvotes: 9

Related Questions