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

Consider Expanding Browser Section w/Simple Example #336

Open
abhillman opened this issue Dec 12, 2023 · 2 comments
Open

Consider Expanding Browser Section w/Simple Example #336

abhillman opened this issue Dec 12, 2023 · 2 comments

Comments

@abhillman
Copy link

Here is one such option:

# Clone racketscript
git clone git@github.com:racketscript/racketscript.git rs
cd rs

# Build and setup paths
make setup
export PATH="$PATH:$(git rev-parse --show-toplevel)/racketscript-compiler/bin/"

# Add a `scratch/` path to git exclude
echo 'scratch/' >> .git/info/exclude
mkdir scratch/

# Write a 'hello, world!' racket script
echo '#lang racket\n(print "hello, world!")' > scratch/module.rkt

# Ensure the racket script works
racket scratch/module.rkt

# Compile to racketscript
racks scratch/module.rkt

# Create a module.html file
cd js-build
echo '<!doctype html><html><head><script type="module" src="modules/module.rkt.js"></script></head></html>' > module.html

# Start a simple http server
python3 -m http.server

# Navigate to http://localhost:8000/module.html
image

TODOs:

  • cause console.log to be invoked
  • consider creating a project in a different path
  • add an example that demonstrates creating DOM elements

Other potential TODOs:

  • replace python -m http.server with an equivalent racket call
@sorawee
Copy link

sorawee commented Dec 12, 2023

An equivalent of python -m http.server in Racket is raco static-web, but you need to install raco-static-web package first.

@abhillman
Copy link
Author

Regarding cause console.log to be invoked, it looks like (#js*.console.log ...) is that gesture. Related: #337.

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

No branches or pull requests

2 participants