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

Make 'npm start' serve examples. #39

Merged
merged 1 commit into from Feb 27, 2016

Conversation

@islemaster
Copy link
Collaborator

islemaster commented Feb 24, 2016

I was trying to reverify #28 after the most recent rebase and realized you can't just open examples/index.html, so I thought this might be useful.

Uses the 'http-server' package to serve the examples directory on localhost:8080, and automatically opens them in a browser window. This is a nice easy way to view the examples from a local copy of p5.play, since the AJAX requests they use to load the library are blocked by CORS rules when trying to open from a file:// URL.

This seems like an appropriate use of npm start for this library, which typically starts a server. You might consider an alternate approach, where npm start is used to begin a watch process for development, but since there's no 'build' system here that makes less sense to me.

Loading examples/index.html from filesystem:
screenshot from 2016-02-24 14-25-22

Running npm start:
screenshot from 2016-02-24 14-25-56

Use from terminal:
screenshot from 2016-02-24 14-31-36

Uses the 'http-server' module to serve the examples directory
on localhost:8080, and automatically opens a browser window
to http://localhost:8080/index.html.  This is a nice easy way
to view the examples from a local copy of p5.play, since the
AJAX requests they use to load the library are blocked by
CORS rules when trying to open from a file:// URL.
@toolness

This comment has been minimized.

Copy link
Collaborator

toolness commented Feb 27, 2016

This is great, thanks!

toolness added a commit that referenced this pull request Feb 27, 2016
Make 'npm start' serve examples.
@toolness toolness merged commit c20d58d into molleindustria:master Feb 27, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@islemaster islemaster deleted the islemaster:serve-examples branch Feb 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.