从 Github 存储库制作 Gist 以在 bl.ocks.org 上展示 [英] Make Gist from Github repo for display on bl.ocks.org
问题描述
我创建了一个数据可视化应用程序并将其发布为 Github 页面.我现在想在聚合 D3.js 可视化的 bl.ocks.org 站点上显示它.如何从 github repo 开始并创建一个 gist 来维护 repo 代码的相对依赖项?我是否需要重构所有代码以制作一个仅指向 CDN 源的单文件应用程序?
I have created a data visualization app and posted it as a Github page. I would now like to display this on the bl.ocks.org site that aggregates D3.js visualizations. How can I start from the github repo and create a gist that maintains the relative dependencies of the repo code? Will I need to refactor all the code to make a single-file app that points to only CDN sources?
推荐答案
通过示例最容易学习.以 bl.ocks 主页为例:
It's easiest to learn by example. Take the example on the bl.ocks home page:
http://bl.ocks.org/mbostock/1353700
现在要查看生成它的 gist,只需从 url 末尾获取 id 号并将其附加到 gist url,如下所示:
Now to see the gist that generated it, just take the id number from the end of the url and appent it the gist url, like so:
http://gist.github.com/1353700
该要点包含 3 个文件,但其中两个是可选的.显示块的唯一要求是拥有 index.html.该文件应该包含一个完整的 html 文件和你的 js 脚本,任何包含到像 d3 这样的 CDN 资源.或者,您可以将您的 javascript 代码放在一个单独的文件中并将其添加到要点中,然后从您的 index.html 文件链接到它.
That gist contains 3 files, but two are optional. The only requirement for a block to display is to have index.html. That file should contain your a full html file with your js script any includes to cdn resources like d3. Optionally, you could put your javascript code in a separate file and add that to the gist, and then link to it from your index.html file.
如果您想提供示例的描述和图像,您还可以添加 README.md 和缩略图.png.这也在 bl.ocks 主页上进行了解释.
You can also add a README.md and thumbnail.png, if you'd like to provide a description of your example and an image for it. This is explained on the bl.ocks home page as well.
希望有所帮助.
这篇关于从 Github 存储库制作 Gist 以在 bl.ocks.org 上展示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!