2017-03-16 37 views
0

我有几个p5.js草图,所有这些草图都在本地工作,但没有一个会显示在GitHub页面上。下面是HTML:p5 js草图在本地工作,但不在github

<html> 
<head> 
<meta charset="UTF-8"> 
<script language="javascript" type="text/javascript" src="libraries/p5.js"></script> 
<script language="javascript" type="text/javascript" src="sketch1.js"></script> 
<style> body {padding: 0; margin: 0;} </style> 
</head> 
<body> 

这里是JavaScript:

function setup() { 
createCanvas(500,500); 
background(250, 212, 210); 
strokeWeight(4); 
} 

function draw() { 
line(mouseX, mouseY, pmouseX, pmouseY); 
if (mouseIsPressed == true) { 
    stroke(250, 3, 80); 
} else { 
    stroke(110, 164, 249); 
} 

} 
+0

你能提供一个链接到github页面吗?此外,您需要熟悉[开发人员工具](http://happycoding.io/tutorials/javascript/developer-tools)。机会是你的错误在那里。 –

+0

我现在要回顾一下开发者工具。 [here](https://bethanyrennard.github.io/hello-wurld/)是GitHub页面 –

+0

您刚刚链接的GitHub页面不包含任何可运行的p5.js代码,也不会将其添加到您的页面。 –

回答

0

如果你从GitHub的存储库访问.html文件,它不会实际显示渲染html页面本身,但只有源代码。如果你想在GitHub上预览html文件,this答案和this答案解决这个问题。

0

我想也许你只是忘了添加一个目录到你的仓库(或者可能忘记把更改推到github上)。我在您的回购中看到6个文件,其中包括p5.js:110-click.html116.html114.html,index copy.html,127-click.html129-click.html。所有这些包括libraries/p5.js,但存储库中没有libraries目录。

我猜你需要使用git add libraries从回购根目录添加此目录(然后提交并推送到github)。

相关问题