Skip to content

Commit ed8a386

Browse files
authoredNov 20, 2023
Merge pull request #6004 from roc-lang/launch-wip
Replace roc-lang.org with WIP site
2 parents dc1a7ae + 4454924 commit ed8a386

35 files changed

+1807
-5885
lines changed
 

‎.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ roc_linux_x86_64.tar.gz
6161
# nix
6262
result
6363

64-
# tutorial
65-
www/src/roc-tutorial
66-
6764
# Only keep Cargo.lock dependencies for the main compiler.
6865
# Examples and test only crates should be fine to be unlocked.
6966
# This remove unneccessary lock file versioning.
@@ -77,7 +74,11 @@ www/src/roc-tutorial
7774
# checkmate
7875
checkmate_*.json
7976

77+
www/build/
78+
www/main
79+
www/dist
80+
8081
# ignore the examples folder in the WIP website, this is copied from roc-lang/examples in when building the site
81-
www/wip_new_website/content/examples
82+
www/content/examples
8283
www/examples-main.zip
8384
www/examples-main

‎www/.gitignore

-3
This file was deleted.
File renamed without changes.

‎www/README.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
# www.roc-lang.org
22

3-
To view the website after you've made a change, execute:
3+
## Prerequisites
4+
5+
- Linux or MacOS operating system, Windows users can use linux through WSL.
6+
- Install [git](https://chat.openai.com/share/71fb3ae6-80d7-478c-8a27-a36aaa5ba921)
7+
- Install [nix](https://nixos.org/download.html)
8+
9+
## Building the website from scratch
10+
411
```bash
12+
git clone https://github.com/roc-lang/roc.git
13+
cd roc
14+
nix develop
515
./www/build.sh
6-
cd www/build
7-
simple-http-server --nocache --index # already installed if you're using `nix develop`, otherwise use `cargo install simple-http-server`
16+
# make the roc command available
17+
export PATH="$(pwd)/target/release/:$PATH"
18+
bash build-dev-local.sh
19+
```
20+
21+
Open http://0.0.0.0:8080 in your browser.
22+
23+
## After you've made a change locally
24+
25+
In the terminal where the web server is running:
26+
1. kill the server with Ctrl+C
27+
2. re-run the build script
28+
3. refresh the page in your browser
29+
30+
To view the website after you've made a change, execute:
31+
```bash
32+
bash build-dev-local.sh
833
```
9-
Open http://0.0.0.0:8000 in your browser.
34+
Open http://0.0.0.0:8080 in your browser.
1035

1136

1237

‎www/wip_new_website/build-dev-local.sh ‎www/build-dev-local.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ DIR="$(dirname "$0")"
1111
cd "$DIR" || exit
1212

1313
rm -rf dist/
14-
cp -r ../build dist/
15-
mkdir -p dist/wip
16-
roc run main.roc -- content/ dist/wip/
17-
cp -r static/* dist/wip/
14+
cp -r build dist/
15+
cp -r public/* dist/
16+
roc run main.roc -- content/ dist/
1817

1918
npx http-server dist/ -p 8080 -c-1 --cors

‎www/build.sh

+9-22
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ cd $SCRIPT_RELATIVE_DIR
1717

1818
rm -rf build/
1919
cp -r public/ build/
20-
mkdir build/wip # for WIP site
2120

2221
# download the latest code for the examples
2322
echo 'Downloading latest examples...'
24-
curl -fLJO https://github.com/roc-lang/examples/archive/refs/heads/main.zip
25-
unzip examples-main.zip
26-
cp -R examples-main/examples/ wip_new_website/content/examples/
23+
curl -fL -o examples-main.zip https://github.com/roc-lang/examples/archive/refs/heads/main.zip
24+
rm -rf examples-main/
25+
unzip -o examples-main.zip
26+
cp -R examples-main/examples/ content/examples/
2727

28-
# relace links in wip_new_website/content/examples/index.md to work on the WIP site
29-
sed -i 's|](/|](/wip/examples/|g' wip_new_website/content/examples/index.md
28+
# relace links in content/examples/index.md to work on the WIP site
29+
perl -pi -e 's|\]\(/|\]\(/examples/|g' content/examples/index.md
3030

3131
# clean up examples artifacts
3232
rm -rf examples-main examples-main.zip
@@ -48,11 +48,10 @@ curl -fLJO https://github.com/roc-lang/roc/archive/www.tar.gz
4848
# Download the latest pre-built Web REPL as a zip file. (Build takes longer than Netlify's timeout.)
4949
REPL_TARFILE="roc_repl_wasm.tar.gz"
5050
curl -fLJO https://github.com/roc-lang/roc/releases/download/nightly/$REPL_TARFILE
51+
mkdir repl
5152
tar -xzf $REPL_TARFILE -C repl
52-
tar -xzf $REPL_TARFILE -C wip # note we also need this for WIP repl
5353
rm $REPL_TARFILE
5454
ls -lh repl
55-
ls -lh wip
5655

5756
popd
5857

@@ -77,9 +76,6 @@ rm -rf roc_nightly roc_releases.json
7776

7877
# we use `! [ -v GITHUB_TOKEN_READ_ONLY ];` to check if we're on a netlify server
7978
if ! [ -v GITHUB_TOKEN_READ_ONLY ]; then
80-
echo 'Building tutorial.html from tutorial.md...'
81-
mkdir www/build/tutorial
82-
8379
cargo build --release --bin roc
8480

8581
roc=target/release/roc
@@ -96,19 +92,12 @@ else
9692
mv roc_nightly* roc_nightly
9793

9894
roc='./roc_nightly/roc'
99-
100-
echo 'Building tutorial.html from tutorial.md...'
101-
mkdir www/build/tutorial
10295
fi
10396

10497
$roc version
105-
$roc run www/generate_tutorial/src/tutorial.roc -- www/generate_tutorial/src/input/ www/build/tutorial/
106-
mv www/build/tutorial/tutorial.html www/build/tutorial/index.html
10798

108-
# For WIP site
109-
echo 'Building WIP site...'
110-
$roc run www/wip_new_website/main.roc -- www/wip_new_website/content/ www/build/wip/
111-
cp -r www/wip_new_website/static/* www/build/wip/
99+
echo 'Building site markdown content'
100+
$roc run www/main.roc -- www/content/ www/build/
112101

113102
# cleanup
114103
rm -rf roc_nightly roc_releases.json
@@ -153,5 +142,3 @@ if [ -v GITHUB_TOKEN_READ_ONLY ]; then
153142
rm -rf $BASIC_CLI_DIR/generated-docs
154143
done <<< "$VERSION_NUMBERS"
155144
fi
156-
157-
popd
File renamed without changes.
File renamed without changes.

‎www/wip_new_website/content/docs.md ‎www/content/docs.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ In the future, a language reference will be on this page too.
99
## [Guides](#guides) {#guides}
1010

1111
- [FAQ (Frequently Asked Questions)](https://github.com/roc-lang/roc/blob/main/FAQ.md)
12+
- [Platforms & Applications](/platforms)
1213
- [Roc for Elm Programmers](https://github.com/roc-lang/roc/blob/main/roc-for-elm-programmers.md)
1314
- [Tutorial](/tutorial)

‎www/wip_new_website/content/donate.md ‎www/content/donate.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You can donate to Roc's development using:
66
- [GitHub Sponsors](https://github.com/sponsors/roc-lang)
77
- [Liberapay](https://liberapay.com/roc_lang)
88

9-
All donations go through the [Roc Programming Language Foundation](https://foundation.roc-lang.org/), a registered [US 501(c)(3) nonprofit organization](https://en.wikipedia.org/wiki/501(c)(3)_organization), which means these donations are tax-exempt in the US.
9+
All donations go through the [Roc Programming Language Foundation](https://foundation.roc-lang.org/), a registered <a href="https://en.wikipedia.org/wiki/501(c)(3)_organization">US <span class="nowrap">501(c)(3)</span> nonprofit organization</a>, which means these donations are tax-exempt in the US.
1010

1111
It also means that the foundation's tax filings are a [matter of public record](https://en.wikipedia.org/wiki/501(c)(3)_organization#Transparency), so you have real transparency into how your donations are advancing Roc!
1212

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎www/wip_new_website/content/index.md ‎www/content/index.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
<section class="home-goals-container" aria-label="Roc's Design: Fast, Friendly, Functional">
1414
<div role="presentation" class="home-goals-column">
15-
<a href="/wip/fast" class="home-goals-content">
15+
<a href="/fast" class="home-goals-content">
1616
<h3 class="home-goals-title">Fast</h3>
1717
<p class="home-goals-description">Roc code is designed to build fast and <span class="nowrap">run fast</span>. It compiles to machine code or WebAssembly.</p>
1818
<p class="home-goals-learn-more">What does <i>fast</i> mean here?</p>
1919
</a>
2020
</div>
2121
<div role="presentation" class="home-goals-column">
22-
<a href="/wip/friendly" class="home-goals-content">
22+
<a href="/friendly" class="home-goals-content">
2323
<h3 class="home-goals-title">Friendly</h3>
2424
<p class="home-goals-description">Roc's syntax, semantics, and included toolset all prioritize user-friendliness.</p>
2525
<p class="home-goals-learn-more">What does <i>friendly</i> mean here?</p>
2626
</a>
2727
</div>
2828
<div role="presentation" class="home-goals-column">
29-
<a href="/wip/functional" class="home-goals-content">
29+
<a href="/functional" class="home-goals-content">
3030
<h3 class="home-goals-title">Functional</h3>
3131
<p class="home-goals-description">
3232
Roc has a small number of simple language primitives. It's a single-paradigm <span class="nowrap">functional language.</span></p>
@@ -57,7 +57,7 @@
5757
<textarea aria-label="Input Roc code here, then press Enter to submit it to the REPL" rows="5" id="source-input" placeholder="Enter some Roc code here."></textarea>
5858
</div>
5959
</div>
60-
<script type="module" src="/wip/site.js"></script>
60+
<script type="module" src="/site.js"></script>
6161
</section>
6262

6363
## [Examples](#examples) {#examples}
@@ -75,14 +75,14 @@ Here are some examples of how it can be used today.
7575
<pre><samp class="code-snippet">main <span class="kw">=</span>
7676
Stdout<span class="punctuation section">.</span>line <span class="literal">"Hello!"</span></samp></pre>
7777
<p>You can use Roc to create scripts and command-line interfaces (CLIs). The compiler produces binary executables, so Roc programs can run on devices that don't have Roc itself installed.</p>
78-
<p>As an example, the HTML for this website is generated using a simple Roc script. You can see <a href="https://github.com/roc-lang/roc/blob/main/www/wip_new_website/main.roc">the code for it</a> in the main Roc code repository.</p>
79-
<p>If you're looking for a starting point for building a command-line program in Roc, <a href="https://github.com/roc-lang/basic-cli">basic-cli</a> is a popular platform to check out.</p>
78+
<p>As an example, the HTML for this website is generated using a simple Roc script. You can see <a href="https://github.com/roc-lang/roc/blob/main/www/generate_website/main.roc">the code for it</a> in the main Roc code repository.</p>
79+
<p>If youre looking for a starting point for building a command-line program in Roc, <a href="https://github.com/roc-lang/basic-cli">basic-cli</a> is a popular <a href="/platforms">platform</a> to check out.</p>
8080
</div>
8181
<div role="presentation" class="home-examples-column">
8282
<h3 class="home-examples-title">Web Servers</h3>
8383
<pre><samp class="code-snippet">handleReq <span class="kw">=</span> <span class="kw">\</span>request <span class="kw">-&gt;</span>
8484
Task<span class="punctuation section">.</span>ok <span class="literal">{</span> body: <span class="comment">…</span> <span class="literal">}</span></samp></pre>
85-
<p>You can also build web servers in Roc. <a href="https://github.com/roc-lang/basic-webserver">basic-webserver</a> is a platform with
85+
<p>You can also build web servers in Roc. <a href="https://github.com/roc-lang/basic-webserver">basic-webserver</a> is a <a href="/platforms">platform</a> with
8686
a simple interface: you write a function which takes a <code>Request</code>, does some I/O, and returns a <code>Response</code>.</p>
8787
<p>Behind the scenes, it uses Rust's high-performance <a href="https://docs.rs/hyper/latest/hyper/">hyper</a> and <a href="https://tokio.rs/">tokio</a> libraries to execute your Roc function on incoming requests.</p>
8888
<p>For database access, <a href="https://github.com/agu-z/roc-pg">roc-pg</a> lets you access a <a href="https://www.postgresql.org/">PostgreSQL</a> database&mdash;with your Roc types checked against the types in your database's schema.</p>
@@ -98,7 +98,7 @@ log(<span class="string">`Roc says </span><span class="kw">${</span>fn()<span cl
9898
</div>
9999

100100
### [Other Examples](#other-examples) {#other-examples}
101-
You can find more use cases and examples on the [examples page](/wip/examples)!
101+
You can find more use cases and examples on the [examples page](/examples)!
102102
</section>
103103

104104

File renamed without changes.

‎www/content/platforms.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Platforms
2+
3+
Something that sets Roc apart from other programming languages is its <span class="nowrap">*platforms and applications*</span> architecture.
4+
5+
## [Applications](#applications) {#applications}
6+
7+
Here is a Roc application that prints `"Hello, World!"` to the command line:
8+
9+
```roc
10+
app "hello"
11+
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br" }
12+
imports [pf.Stdout]
13+
provides [main] to pf
14+
15+
main =
16+
Stdout.line "Hello, World!"
17+
```
18+
19+
Every Roc application, including this one, is built on a _platform_. This application happens to be built on a platform called [basic-cli](https://github.com/roc-lang/basic-cli), which is a platform for building command-line interfaces.
20+
21+
## [Domain-specific functionality](#domain-specific) {#domain-specific}
22+
23+
Roc platforms provide domain-specific functionality that multiple applications can use as a foundation to build on, much like game engines and Web frameworks do.
24+
25+
Also like many game engines and Web frameworks, Roc platforms have a high-level Roc API which presents a nice interface to a lower-level implementation (written in a different language), which provides the foundational primitives that platform needs to operate—such as a C++ 3D rendering system in a game engine, or a Rust HTTP networking system in a Web framework.
26+
27+
Here are some example Roc platforms, and functionality they might provide:
28+
29+
* A Roc game engine platform might provide functionality for rendering and sound.
30+
* A Roc Web server platform (like [basic-webserver](https://github.com/roc-lang/basic-webserver)) probably would not provide functionality for rendering and sound, but it might provide functionality for responding to incoming HTTP requests—which a game engine platform likely would not.
31+
* A Roc native [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) platform might provide functionality for defining native operating system UI elements, whereas a game engine platform might focus more on rendering with [shaders](https://en.wikipedia.org/wiki/Shader), and a Web server platform would not have GUI functionality at all.
32+
33+
These are broad domains, but platforms can be much more specific than this. For example, anyone could make a platform for writing [Vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) plugins, or [Postgres](https://en.wikipedia.org/wiki/PostgreSQL) extensions, or robots ([which has already happened](https://roc.zulipchat.com/#narrow/stream/304902-show-and-tell/topic/Roc.20on.20a.20microcontroller/near/286678630)), or even [implementing servo logic for a clock that physically turns panels to simulate an LCD](https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Roc.20Clock/near/327939600). You really can get as specific as you like!
34+
35+
Platforms can also be designed to have a single, specific application run on them. For example, you can make a platform that is essentially "your entire existing code base in another language," and then use Roc as an embedded language within that code base. For example, [Vendr](https://www.vendr.com/careers) is using this strategy to call Roc functions from their [Node.js](https://nodejs.org/en) backend using [roc-esbuild](https://github.com/vendrinc/roc-esbuild), as a way to incrementally transition code from Node to Roc.
36+
37+
## [Platform scope](#scope) {#scope}
38+
39+
Roc platforms have a broader scope of responsibility than game engines or Web frameworks. In addition to providing a nice domain-specific interface, platforms are also responsible for:
40+
* Tailoring memory management to that domain (more on this later)
41+
* Providing all I/O primitives
42+
43+
In most languages, I/O primitives come with the standard library. In Roc, the [standard library](https://www.roc-lang.org/builtins/) contains only data structures; an application gets all of its I/O primtiives from its platform. For example, in the "Hello, World" application above, the `Stdout.line` function comes from the `basic-cli` platform itself, not from Roc's standard library.
44+
45+
This design has a few benefits.
46+
47+
### [Ecosystem benefits](#ecosystem) {#ecosystem}
48+
49+
Some I/O operations make sense in some use cases but not others.
50+
51+
For example, suppose I'm building an application on a platform for command-line interfaces, and I use a third-party package which sometimes blocks the program while it waits for [standard input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This might be fine for my command-line application, but it would probably be a very bad fit if I'm using a webserver. Similarly, a package which does some occasional file I/O for caching might work fine on either of those platforms, but might break in surprising ways when used in a platform that's designed to run in a browser on WebAssembly—since browsers don't offer arbitrary file I/O access!
52+
53+
Because Roc's I/O primitives come from platforms, these mismatches can be prevented at build time. The browser-based platform would not expose file I/O primitives, the webserver wouldn't expose a way to block on reading from standard input, and so on. (Note that there's a design in the works for allowing packages which perform I/O to work across multiple platforms—but only platforms which support the I/O primitives it requires—but this design has not yet been implemented.)
54+
55+
### [Security benefits](#security) {#security}
56+
57+
Since platforms have exclusive control over all I/O primitives, one of the things they can do is create domain-specific security guarantees around them. For example, a platform for writing text editor plugins might want to display a prompt to the end user before performing any file I/O operations outside the directory that's currently open in the editor.
58+
59+
[This talk](https://www.youtube.com/watch?v=cpQwtwVKAfU&t=75s) shows an example of taking this idea a step further with a "safe scripting" platform for writing command-line scripts. The idea is that you could download a script from the Internet and run it on this platform without worrying that the script would do bad things to your computer, because the platform would (much like a Web browswer) show you specific prompts before allowing the script to do potentially harmful I/O, such as filesystem operations.
60+
61+
These security guarantees can be relied on because platforms have *exclusive* control over all I/O primitives, including how they are implemented. There are no escape hatches that a malicious program could use to get around these, either; for example, Roc programs that want to call functions in other languages must do so using primitives provided by the platform, which the platform can disallow (or sandbox with end-user prompts) in the same way.
62+
63+
### [Performance benefits](#performance) {#performance}
64+
65+
Many I/O operations can benefit from being run concurrently. Since platforms are in charge of how those I/O operations are implemented, they can also determine how they are scheduled. This means that both applications and packages can describe which operations they want to run concurrently, and then the platform can optimize the scehduling of these operations using its domain-specific knowledge.
66+
67+
For example, a command-line platform might schedule concurrent operations across all available cores (or some lower number specified by a command-line argument). In contrast, a Web server platform might try to balance available cores across multiple request handlers—to prevent undesirable scenarios like one handler getting all the cores (meaning none of the others can progress).
68+
69+
Note that although platform-implemented scheduling of concurrent operations is theoretically possible today, there are currently some missing pieces to make it practical for platform authors to implement. Implementing those missing pieces is already in progress, but is not yet complete.
70+
71+
## [How platforms are implemented](#implementation) {#implementation}
72+
73+
To understand how platforms can tailor automatic memory management to their particular domain, it's helpful to understand how platforms are implemented.
74+
75+
### [The Host and the Roc API](#host-and-roc-api) {#host-and-roc-api}
76+
77+
Each platform consists of two parts:
78+
* **The Roc API** is the part that application authors see. For example, `Stdout.line` is part of basic-cli's Roc API.
79+
* **The Host** is the under-the-hood implementation written in a language other than Roc. For example, basic-cli's host is written in Rust. It has a Rust function which implements the behavior of the `Stdout.line` operation, and all the other I/O operations it supports.
80+
81+
This design means that application authors don't necessarily need to know (or care) about the non-Roc language being used to implement the platform's host. That can be a behind-the-scenes implementation detail that only the platform's author(s) are concerned with. Application authors only interact with the public-facing Roc API.
82+
83+
### [Memory management](#memory) {#memory}
84+
85+
Host authors implement not only the platform's I/O primitives, but also functions for memory allocation and deallocation. In C terms, the host provides [`malloc` and `free`](https://en.wikipedia.org/wiki/C_dynamic_memory_allocation) implementations which the compiled Roc application will automatically call whenever it needs to allocate or deallocate memory.
86+
87+
[The same talk mentioned earlier](https://www.youtube.com/watch?v=cpQwtwVKAfU&t=75s) in the context of [security benefits](#security) demonstrates some benefits of this, such as being able to get accurate diagnostics on how much memory the Roc part (or even specific Roc parts) of a running program are using.
88+
89+
The bigger benefit is tailoring memory management itself based on the domain. For example, [nea](https://github.com/tweedegolf/nea/) is a work-in-progress Web server which performs [arena allocation](https://en.wikipedia.org/wiki/Region-based_memory_management) on each request handler. In Roc terms, this means the host's implementation of `malloc` can allocate into the current handler's arena, and `free` can be a no-op. Instead, the arena can be reset when the response has been sent.
90+
91+
In this design, heap allocations in a Web server running on `nea` are about as cheap as stack allocations, and deallocations are essentially free. This is much better for the server's throughput, latency, and predictability than (for example) having to pay for periodic garbage collection!
92+
93+
### [Program start](#program-start) {#program-start}
94+
95+
When a compiled Roc program runs, it's actually the host—not the Roc application—which starts running first. In C terms, the host implements `main()`, and then at some point it calls a function exposed by the compiled Roc application.
96+
97+
Knowing this, a useful mental model for how Roc platforms and applications interact at the implementation level is: the Roc application compiles down to a C library which the platform can choose to call (or not).
98+
99+
This is essentially what's happening behind the scenes when you run `roc build`. Specifically:
100+
1. The Roc compiler builds the Roc application into a binary [object file](https://en.wikipedia.org/wiki/Object_file)
101+
2. Since that application specified its platform, the compiler then looks up the platform's host implementation (which the platform will have provided as an already-compiled binary)
102+
3. Now that it has a binary for the Roc application and a binary for the host, it links them together into one combined binary in which the host portion calls the application portion as many times as it likes.
103+
104+
This process works for small platforms and large applications (for example, a very large Web server application) as well as for large platforms and small applications (for example, a very large C++ game which serves as a platform for a small amount of Roc application code that the game uses for scripting).
105+
106+
## [Summary](#summary) {#summary}
107+
108+
Every Roc application has exactly one platform. That platform provides all the I/O primitives that the application can use; Roc's standard library provides no I/O operations, and the only way for a Roc application to execute functions in other languages is if the platform offers a way to do that.
109+
110+
This I/O design has [security benefits](#security), [ecosystem benefits](#ecosystem), and [performance benefits](#performance). The [domain-specific memory management](#memory) platforms can implement can offer additional benefits as well.
111+
112+
Applications only interact with the *Roc API* portion of a platform, but there is also a *host* portion (written in a different language) that works behind the scenes. The host determines how the program starts, how memory is allocated and deallocated, and how I/O primitives are implemented.
113+
114+
Anyone can implement their own platform. There isn't yet an official guide about how to do this, so the best way to get help if you'd like to create a platform is to [say hi in the `#beginners` channel](https://roc.zulipchat.com/#narrow/stream/231634-beginners) on [Roc Zulip!](https://roc.zulipchat.com)

‎www/content/repl/index.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
## The rockin' Roc REPL
3+
4+
<div id="repl-container" role="presentation">
5+
<div id="repl" role="presentation">
6+
<code class="history">
7+
<div id="repl-intro-text">Enter an expression to evaluate, or a definition (like <span class="color-blue">x = 1</span>) to use later.</div>
8+
<div id="history-text" aria-live="polite"></div>
9+
</code>
10+
<div id="repl-prompt" role="presentation">»</div>
11+
<textarea aria-label="Input Roc code here, then press Enter to submit it to the REPL" rows="5" id="source-input" placeholder="Enter some Roc code here."></textarea>
12+
</div>
13+
</div>
14+
<script type="module" src="/site.js"></script>
15+
</section>

‎www/wip_new_website/content/tutorial.md ‎www/content/tutorial.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<nav id="tutorial-toc">
1+
<input id="tutorial-toc-toggle" name="tutorial-toc-toggle" type= "checkbox">
2+
<nav id="tutorial-toc" aria-label="Table of Contents">
3+
<label id="close-tutorial-toc" for="tutorial-toc-toggle">close</label>
4+
<!-- TODO fix search: input [id "toc-search", type "text", placeholder "Search"] [] -->
25
<ol>
36
<li><a href="#repl">REPL</a></li>
47
<li><a href="#building-an-application">Building an Application</a></li>

‎www/generate_tutorial/.gitignore

-2
This file was deleted.

‎www/generate_tutorial/src/input/tutorial.md

-1,989
This file was deleted.

‎www/generate_tutorial/src/tutorial.roc

-116
This file was deleted.

‎www/wip_new_website/main.roc ‎www/main.roc

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
app "roc-website"
2-
packages { pf: "../../examples/static-site-gen/platform/main.roc" }
2+
packages { pf: "../examples/static-site-gen/platform/main.roc" }
33
imports [
44
pf.Html.{ Node, html, head, body, header, footer, div, span, main, text, nav, a, link, meta, script },
55
pf.Html.Attributes.{ attribute, content, name, id, href, rel, lang, class, title, charset, color, ariaLabel, ariaHidden, type },
@@ -74,7 +74,7 @@ view = \page, htmlContent ->
7474
preloadWoff2 "/fonts/source-code-pro-v22-latin/source-code-pro-v22-latin-regular.woff2",
7575
preloadWoff2 "/fonts/permanent-marker-v16-latin/permanent-marker-v16-latin-regular.woff2",
7676
link [rel "prefetch", href "/repl/roc_repl_wasm.js"],
77-
link [rel "stylesheet", href "/wip/site.css"],
77+
link [rel "stylesheet", href "/site.css"],
7878
# Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
7979
# fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it.
8080
link [rel "mask-icon", href "/favicon.svg", color "#7d59dd"],
@@ -103,19 +103,19 @@ viewNavbar = \page ->
103103
isHomepage = page == "index.html"
104104

105105
homeLinkAttrs =
106-
[id "nav-home-link", href "/wip/", title "The Roc Programming Language Homepage"]
106+
[id "nav-home-link", href "/", title "The Roc Programming Language Homepage"]
107107
|> List.concat (if isHomepage then [ariaHidden "true"] else [])
108108

109109
header [id "top-bar"] [
110110
nav [ariaLabel "primary"] [
111111
a homeLinkAttrs [rocLogo, span [class "home-link-text"] [text "Roc"]],
112112
div [id "top-bar-links"] [
113-
a [href "/wip/tutorial"] [text "tutorial"],
114-
a [href "/wip/install"] [text "install"],
115-
a [href "/wip/examples"] [text "examples"],
116-
a [href "/wip/community"] [text "community"],
117-
a [href "/wip/docs"] [text "docs"],
118-
a [href "/wip/donate"] [text "donate"],
113+
a [href "/tutorial"] [text "tutorial"],
114+
a [href "/install"] [text "install"],
115+
a [href "/examples"] [text "examples"],
116+
a [href "/community"] [text "community"],
117+
a [href "/docs"] [text "docs"],
118+
a [href "/donate"] [text "donate"],
119119
],
120120
],
121121
]

‎www/wip_new_website/optimize.sh ‎www/optimize.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ done
4343
popd
4444

4545
# Minify the CSS file, and let esbuild add a content hash to the file name
46-
npm exec --yes esbuild -- --minify dist/wip/site.css --outdir=dist/wip/ --entry-names='[name]-[hash]'
46+
npm exec --yes esbuild -- --minify dist/site.css --outdir=dist/ --entry-names='[name]-[hash]'
4747
# Remove unused original file
48-
rm dist/wip/site.css
48+
rm dist/site.css
4949

5050
# Find the new filename
51-
css_with_hash=$(basename dist/wip/site-*.css)
51+
css_with_hash=$(basename dist/site-*.css)
5252
# Replace all occurances in the html
53-
sed -i "s:/wip/site.css:/wip/${css_with_hash}:g" dist/wip/*.html
53+
sed -i "s:/wip/site.css:/wip/${css_with_hash}:g" dist/*.html

‎www/public/homepage.css

-15
This file was deleted.

‎www/public/index.html

-316
This file was deleted.

‎www/public/repl/index.html

-39
This file was deleted.

‎www/public/repl/repl.css

-173
This file was deleted.

‎www/public/repl/repl.js

-307
This file was deleted.

‎www/public/site.css

+1,110-319
Large diffs are not rendered by default.

‎www/public/site.js

+495-51
Large diffs are not rendered by default.

‎www/public/styles.css

-487
This file was deleted.

‎www/wip_new_website/.gitignore

-4
This file was deleted.

‎www/wip_new_website/README.md

-30
This file was deleted.

‎www/wip_new_website/static/site.css

-1,462
This file was deleted.

‎www/wip_new_website/static/site.js

-515
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.