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

Allow serving static files with GHCJSi #616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fizruk
Copy link
Contributor

@fizruk fizruk commented Nov 18, 2017

This changes allows to serve static files from GHCJSi browser session and makes it possible to:

  • run apps with images, CSS files and other stuff from GHCJSi;
  • have custom ghcjsiClient.html and/or ghcjsiClient.js.

This relies on finalhandler and serve-static packages which one can install using npm:

npm install finalhandler serve-static

I'm not savvy with nam packages, and there seem to be more alternatives to static file servers.
If you think different packages should be used — feel free to change that.

By default static server is disabled. To serve files set GHCJSI_STATIC_DIR environment variable, e.g:

export GHCJSI_STATIC_DIR=$(pwd)/static

A gist with example usage: https://gist.github.com/fizruk/fb5bad8a08a4b788764851c11ebbadf8

@dmjio
Copy link

dmjio commented Nov 19, 2017

Bravo @fizruk :) not afraid to write js!

@fizruk
Copy link
Contributor Author

fizruk commented May 6, 2018

I've just uploaded a Docker image fizruk/stack-ghcjs with support for static files built in.
Hopefully this will be useful to someone besides me :)

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 this pull request may close these issues.

None yet

2 participants