最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

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).

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).

Share Improve this question edited Oct 5, 2013 at 20:45 Dhana Krishnasamy asked Oct 3, 2013 at 11:52 Dhana KrishnasamyDhana Krishnasamy 2,17618 silver badges36 bronze badges 1
  • That citations doesn't make your question better, this is actually exactly the type of question you should not ask. Better ask "How can i include javascript libraries from arbitrary github repositories without hosting them myself when fiddling around" – Bergi Commented Oct 5, 2013 at 18:41
Add a ment  | 

1 Answer 1

Reset to default 9

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./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./k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css that works just perfect in jsfiddle.

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

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

Cheers!

发布评论

评论列表(0)

  1. 暂无评论