Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data path references https://toolness.github.io/p5.js-widget/* if using with loadTable, etc. #39

Closed
indefinit opened this issue Apr 15, 2016 · 7 comments · Fixed by #47

Comments

@indefinit
Copy link

indefinit commented Apr 15, 2016

If I'm using loadTable, loadXML, etc. functions with this widget src'ed from your github (for example):

<script src="https://toolness.github.io/p5.js-widget/p5-widget.js"></script>

then the data path will reference toolness.github instead of my local index. This is potentially a problem since it will likely break any user code expecting to load data from my local index, resulting in a 404. Example:

function preload() {
  //my table is comma separated value "csv"
//404 error because https://toolness.github.io/p5.js-widget/data/antarctica_weather_averages.csv
// doesn't exist
table = loadTable("data/antarctica_weather_averages.csv", function(){console.log("found data");});
}

Is there an easy fix to this other than srcing the widget from my local index?

@indefinit
Copy link
Author

also, forgive my ignorance, but is there an easy way of compiling the typescript dependencies into one lib js file?

@toolness
Copy link
Owner

Oh, sorry, I just noticed this issue--for some reason GitHub isn't emailing me when new issues are filed or something.

Good catch! Hmmm, there are multiple ways to tackle this... let me think a bit and get back to you.

also, forgive my ignorance, but is there an easy way of compiling the typescript dependencies into one lib js file?

Hmm, I'm not quite sure what you mean--what are you trying to accomplish? Are you trying to self-host the widget on your own server, or something else?

@indefinit
Copy link
Author

Yea, in this specific case, I'm looking to self host all files from a GitHub. Repo and use raw git as a static file server. I use this for most of my tutorials because its quick and simple to organize from my course repo

@toolness
Copy link
Owner

Ah, gotcha--I've spun that off into #45!

@toolness
Copy link
Owner

Ok, I think I've fixed this! You can read about the new behavior here:

https://toolness.github.io/p5.js-widget/#base-url

Let me know if this works for you!

@indefinit
Copy link
Author

Sorry for the delayed response. Any chace base-url can work with relative paths? For example if I'm developing on localhost but push my code somewhere else, it would be great to have data-base-url="./" to map to the root directory where my index.html lives.

@toolness
Copy link
Owner

No worries! I Just added this in 81835ae.

Note, though, that if you just want the base URL to be the same path as the page you're embedding the widget in, you shouldn't have to provide data-base-url at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants