GitGraph JS未从CDN加载 [英] GitGraph JS not loading from CDN
本文介绍了GitGraph JS未从CDN加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试让 GitGraph 起作用,并为要放入的文档生成类似GitFlow的图形
I'm trying to get GitGraph working and producing a GitFlow-like graph for a document I'm putting together.
这是我的HTML文件:
Here's my HTML file:
<html>
<head>
<title>GitFlow</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css"></script>
<script>
var gitgraph = new GitGraph({
template: "blackarrow",
reverseArrow: false,
orientation: "horizontal",
mode: "compact"
});
</script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css" />
</head>
<body>
<canvas id="gitGraph"></canvas>
</body>
</html>
在浏览器中打开该页面时,我只会得到一个空白页面。在Chrome开发者控制台中,我看到以下错误:
When I open this in a browser I just get an empty/blank page. In Chrome Dev console I see the following error:
Uncaught ReferenceError: GitGraph is not defined
at gitgraph.html:6
因此由于某种原因,它没有从CDN中提取GitGraph。有人可以发现我要去哪里吗?
So for some reason its not pulling in GitGraph from the CDN. Can anybody spot where I'm going awry?
推荐答案
让它可以与此配合使用:
Got it working with this:
<html>
<head>
<title>GitFlow</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css" />
</head>
<body>
<canvas id="gitGraph"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
<script>
var gitgraph = new GitGraph({
template: "blackarrow",
reverseArrow: false,
orientation: "horizontal",
mode: "compact"
});
gitgraph.branch().commit().commit();
</script>
</body>
</html>
这篇关于GitGraph JS未从CDN加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文