我可以直接从GitHub运行HTML文件,而不只是查看它们的源代码? [英] Can I run HTML files directly from GitHub, instead of just viewing their source?

查看:298
本文介绍了我可以直接从GitHub运行HTML文件,而不只是查看它们的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在GitHub存储库中有 .html 文件,例如对于运行一组JavaScript测试,有没有什么方法可以直接查看该页面 - 从而运行测试?

If I have a .html file in a GitHub repository, e.g. for running a a set of JavaScript tests, is there any way I can view that page directly—thus running the tests?

例如,我能否以某种方式真正看到测试结果这将由 jQuery测试套件生成,无需下载或克隆回购到我的本地驱动器,并在那里运行它们?

For example, could I somehow actually see the test results that would be produced by the jQuery test suite, without downloading or cloning the repo to my local drive and running them there?

我知道这基本上将GitHub放在静态内容托管业务中,但是,他们只需要改变他们的MIME类型来自 text / plain to text / html

I know this would basically put GitHub in the static content hosting business, but then again, they just have to change their mime-type from text/plain to text/html.

推荐答案

替代 http://htmlpreview.github.com 应该是 http://rawgithub.com 。它提供了一种更方便的方式来预览您的文件。

An alternative to http://htmlpreview.github.com would be http://rawgithub.com. It provides a more convenient way to preview your files.

更新:网站已重命名为 http:/ /rawgit.com

https://raw.githubusercontent.com/[user]/[repository]/[branch]/[filename.ext]

您的情况 .html 扩展名

https://rawgit.com/[user]/[repository]/[branch]/[filename.ext]

在您的情况 .html extension

In your case .html extension

现在它似乎也可以在制作中使用 CDN ,这非常棒:

Now it seems to be able to use CDN in production as well, which is pretty cool:

https://cdn.rawgit.com/[user]/[repository]/[branch]/[filename.ext]






您也可以使用 gists

https://gist.github.com/[user]/[gist] 



After:



After:

https://rawgit.com/[user]/[gist]/raw/



CDN:



CDN:

https://cdn.rawgit.com/[user]/[gist]/raw/

这篇关于我可以直接从GitHub运行HTML文件,而不只是查看它们的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆