0

I have several p5.js sketches, all of which work locally, but none will display on GitHub pages. Here is the html:

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

and here is the 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);
} 

 }
b x
  • 1
  • Can you please provide a link to the github page? Also, you need to familiarize yourself with [the developer tools](http://happycoding.io/tutorials/javascript/developer-tools). Chances are your error is there. – Kevin Workman Mar 16 '17 at 05:01
  • I'll review the developer tools now. [here](https://bethanyrennard.github.io/hello-wurld/) is the GitHub page – b x Mar 16 '17 at 05:17
  • The GitHub page you just linked to does not contain any runnable p5.js code, nor do you add it to your page. – Kevin Workman Mar 16 '17 at 15:34

2 Answers2

0

If you are accessing the .html file from a GitHub repository, it will not actually display the rendered html page itself, but only the source code. If you would like to preview the html file on GitHub, this answer and this answer address that question.

Community
  • 1
  • 1
Bryce Frank
  • 697
  • 10
  • 24
0

I think maybe you've just forgotten to add a directory to your repository (or perhaps forgotten to push the changes to github). I see 6 files in your repo that include p5.js: 110-click.html, 116.html, 114.html, index copy.html, 127-click.html, and 129-click.html. All of these include libraries/p5.js, but there's no libraries directory in your repository.

I'm guessing you need to use git add libraries from the repo root to add this directory (and then commit and push to github).

abathur
  • 1,047
  • 7
  • 19