Skip to content

Commit 55016d0

Browse files
committed
Add cross-platform commands for quick start and getting started guides. Fixes #2082
1 parent d132b2b commit 55016d0

File tree

11 files changed

+141
-55
lines changed

11 files changed

+141
-55
lines changed

src/_includes/components/lists.css

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,13 @@
2626
margin: 4px 4px 4px 0;
2727
transition: 0.15s linear outline;
2828
}
29-
/* .inlinelist .inlinelist-item:has(> a) {
30-
padding: 0;
31-
}
32-
.inlinelist .inlinelist-item:has(> a) > a {
33-
padding: .2em .5em;
34-
} */
3529

36-
.inlinelist .inlinelist-item.active {
30+
.inlinelist .inlinelist-item:is(:has([aria-selected="true"]), .active) {
3731
background-color: #222;
3832
color: #fff;
3933
font-weight: inherit;
4034
}
41-
.inlinelist .inlinelist-item.active :link,
42-
.inlinelist .inlinelist-item.active :visited {
35+
.inlinelist .inlinelist-item:is(:has([aria-selected="true"]), .active) :is(:link, :visited) {
4336
color: #fff;
4437
}
4538
.inlinelist .inlinelist-item code {

src/_includes/components/quick-start.webc

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,47 @@
1-
<h2 class="mt-0">Quick Start in 2 Steps</h2>
2-
3-
<p>Create a Markdown file.</p>
4-
5-
<syntax-highlight language="bash">
6-
echo '# Page header' > index.md
7-
</syntax-highlight>
8-
9-
<details class="details-expand-bg details-rounded">
10-
<summary>Eleventy requires Node.js <node-minimum></node-minimum> <em>(expand to learn more)</em></summary>
11-
<p>You can check whether or not you have Node installed by running `node --version` in a terminal window. (<a href="/docs/terminal-window/"><em>Well, wait—what is a Terminal window?</em></a>)</p>
12-
<p>If the command is not found or it reports a number lower than <node-minimum></node-minimum>, you will need to <a href="https://nodejs.org/en/download/">download and install Node.js</a> before moving on to the next step.</p>
13-
</details>
1+
<h2 class="mt-0">Quick Start</h2>
2+
3+
<p><strong>Eleventy requires Node.js <node-minimum></node-minimum>.</strong> You can check whether or not you have Node installed by running <code>node --version</code> in a Terminal. (<a href="/docs/terminal-window/"><em>Well, wait—what is a Terminal?</em></a>) If <code>node</code> is not found or it reports a version number below <node-minimum></node-minimum>, you will need to <a href="https://nodejs.org/en/download/">install Node.js</a> before moving on.</p>
4+
5+
<p>Now we’ll create an <code>index.md</code> <a href="https://commonmark.org/help/">Markdown</a> file. You can do this in the text editor of your choice or by running one of these commands in your terminal:</p>
6+
7+
<script type="module" src="/js/seven-minute-tabs.js" webc:keep></script>
8+
<seven-minute-tabs class="tabs-left tabs-full" persist sync>
9+
<div role="tablist" aria-label="Choose your Operating System">
10+
<a href="#quickstart-os-nix" role="tab" data-tabs-persist="os:posix">macOS or Linux</a>
11+
<a href="#quickstart-os-win" role="tab" data-tabs-persist="os:win">Windows</a>
12+
<a href="#quickstart-os-oldwin" role="tab" data-tabs-persist="os:winold">Windows (Older)</a>
13+
<a href="#quickstart-os-all" role="tab" data-tabs-persist="os:all">Cross Platform</a>
14+
</div>
15+
<div id="quickstart-os-nix" role="tabpanel">
16+
<syntax-highlight language="bash">
17+
echo '# Heading' > index.md
18+
</syntax-highlight>
19+
</div>
20+
<div id="quickstart-os-win" role="tabpanel">
21+
<syntax-highlight language="bash">
22+
echo '# Heading' | out-file -encoding utf8 'index.md'
23+
</syntax-highlight>
24+
</div>
25+
<div id="quickstart-os-oldwin" role="tabpanel">
26+
<syntax-highlight language="bash">
27+
echo # Heading > index.md
28+
</syntax-highlight>
29+
</div>
30+
<div id="quickstart-os-all" role="tabpanel">
31+
<syntax-highlight language="bash">
32+
npx @11ty/create index.md "# Heading"
33+
</syntax-highlight>
34+
<p>Learn more about <a href="https://github.com/11ty/create"><code>@11ty/create</code></a> <em>(requires Node.js 18 or newer)</em>.</p>
35+
</div>
36+
</seven-minute-tabs>
1437

1538
<p>Run Eleventy.</p>
1639

1740
<syntax-highlight language="bash">
1841
npx @11ty/eleventy
1942
</syntax-highlight>
2043

21-
<p>Eleventy compiles any files in the current directory matching valid <a href="/docs/languages/">file extensions</a> (<code>.md</code> is one of many) to the output folder (<code>_site</code> by default). It might look like this:</p>
44+
<p>Eleventy compiles any files in the current directory matching valid <a href="/docs/languages/">file extensions</a> (<code>md</code> is one of many) to the <code>_site</code> output folder. It might look like this:</p>
2245

2346
<cli-eleventy-output @show-version>
2447
Writing _site/index.html from ./index.md (liquid)

src/_includes/components/seven-minute-tabs.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ seven-minute-tabs [role="tablist"] {
1717
line-height: 1.8;
1818
text-align: right;
1919
}
20+
seven-minute-tabs.tabs-full [role="tablist"] {
21+
font-size: 0.9375em; /* 15px /16 */
22+
}
23+
seven-minute-tabs.tabs-left [role="tablist"] {
24+
text-align: left;
25+
}
2026
seven-minute-tabs [role="tablist"]:first-child {
2127
margin-bottom: 0.5rem;
2228
}

src/_includes/layouts/base.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ let eleventyComputed = {
7373
{% include 'components/newsletter-signup.css' %}
7474
{# TODO convert to WebC #}
7575
{% include 'components/grid-layout.css' %}
76+
{% include 'components/seven-minute-tabs.css' %}
7677
7778
{% if not skipLegacyBundle %}
7879
{# these components are not yet used on WebC pages #}
7980
{% include 'components/direct-links.css' %}
8081
{% include 'components/breadcrumb.css' %}
81-
{% include 'components/seven-minute-tabs.css' %}
8282
8383
{# these components have been converted to WebC #}
8484
{% include 'components/prism-theme.css' %}

src/docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ module.exports = function (eleventyConfig) {
271271
npx @11ty/eleventy --formats=html,liquid,njk
272272
```
273273

274-
{% callout "info" %}{% addedin "0.9.0" %} <strong>Case sensitivity</strong>: File extensions should be considered case insensitive, cross-platform. While Mac OS, by default, already behaves this way, other operating systems require additional Eleventy code to enable this behavior.{% endcallout %}
274+
{% callout "info" %}{% addedin "0.9.0" %} <strong>Case sensitivity</strong>: File extensions should be considered case insensitive, cross-platform. While macOS, by default, already behaves this way, other operating systems require additional Eleventy code to enable this behavior.{% endcallout %}
275275

276276
### Enable Quiet Mode to Reduce Console Noise
277277

src/docs/debug-performance.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
eleventyNavigation:
3-
key: Performance
3+
key: Debug Performance
44
parent: Debug Mode
55
excerpt: How to analyze your Eleventy build to find bottlenecks.
66
order: 1
@@ -24,7 +24,9 @@ This list is not considered to be exhaustive. It’s just what has been implemen
2424

2525
{% addedin "0.11.0" %} You can use the following `debug` command to show performance measurements for all of these entries (not just those that take longer than 8%).
2626

27-
#### Mac OS (or Linux, etc)
27+
Learn more about [environment variables for debug output](/docs/debugging/#commands).
28+
29+
#### macOS or Linux (et al)
2830

2931
```bash
3032
DEBUG=Eleventy:Benchmark* npx @11ty/eleventy

src/docs/debugging.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can enable this feature by using the `DEBUG` [environment variable](/docs/en
1919

2020
_The commands below assume that Eleventy is installed locally (recommended) but you can learn more about the difference between Local and [Global installation](/docs/global-installation/)._
2121

22-
### Mac OS (or Linux, etc)
22+
### macOS or Linux (et al)
2323

2424
```sh
2525
DEBUG=Eleventy* npx @11ty/eleventy
@@ -35,12 +35,30 @@ Read more about [Windows environment variables](https://www.npmjs.com/package/de
3535
set DEBUG=Eleventy* & npx @11ty/eleventy
3636
```
3737

38-
#### Powershell (VS Code default)
38+
#### Powershell (default in VS Code)
3939

4040
```sh
4141
$env:DEBUG="Eleventy*"; npx @11ty/eleventy
4242
```
4343

44+
### Cross Platform
45+
46+
Use the [`cross-env` package](https://github.com/kentcdodds/cross-env) to compatibly set your environment variables cross-platform.
47+
48+
```sh
49+
npm install cross-env
50+
```
51+
52+
Now add an npm script in your `package.json`, unlocking `npm run debug`:
53+
54+
```json
55+
{
56+
"scripts": {
57+
"debug": "cross-env DEBUG=Eleventy* npx @11ty/eleventy"
58+
}
59+
}
60+
```
61+
4462
## Learn More
4563

4664
Read more at the [`debug` package documentation](https://www.npmjs.com/package/debug).

src/docs/environment-vars.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For private keys and other sensitive information, you’ll want to create a `.en
2727

2828
### Via the command line
2929

30-
#### Mac OS (or Linux, etc)
30+
#### macOS or Linux (et al)
3131

3232
```bash
3333
MY_ENVIRONMENT=production npx @11ty/eleventy
@@ -39,22 +39,27 @@ MY_ENVIRONMENT=production npx @11ty/eleventy
3939
set MY_ENVIRONMENT=production & npx @11ty/eleventy
4040
```
4141

42-
#### Windows Powershell (VS Code default)
42+
#### Windows Powershell (default in VS Code)
4343

4444
```bash
4545
$env:MY_ENVIRONMENT="production"; npx @11ty/eleventy
4646
```
4747

48-
### Via an npm script
48+
#### Cross Platform npm scripts
49+
50+
Use the [`cross-env` package](https://github.com/kentcdodds/cross-env) to compatibly set your environment variables cross-platform.
51+
52+
```sh
53+
npm install cross-env
54+
```
4955

50-
You can also use the above commands in an npm script in your project’s `package.json` file.
5156

5257
{% codetitle "package.json" %}
5358

5459
```js
5560
{
5661
"scripts": {
57-
"build:prod": "MY_ENVIRONMENT=production npx @11ty/eleventy"
62+
"build:prod": "cross-env MY_ENVIRONMENT=production npx @11ty/eleventy"
5863
}
5964
}
6065
```

src/docs/index.webc

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ overrideCommunityLinks: true
1616

1717
<p>Eleventy <eleventy-version></eleventy-version> requires <strong><a href="https://nodejs.org/">Node.js</a> version <node-minimum></node-minimum></strong> or higher.</p>
1818

19-
<p>You can check whether or not you have Node installed by running <code>node --version</code> in a terminal window. (<a href="/docs/terminal-window/"><em>Well, wait—what is a Terminal window?</em></a>) If the command is not found or it reports a number lower than <node-minimum></node-minimum>, you will need to <a href="https://nodejs.org/en/download/">download and install Node.js</a> before moving on to the next step.</p>
19+
<p>You can check whether or not you have Node installed by running <code>node --version</code> in a terminal application. (<a href="/docs/terminal-window/"><em>Well, wait—what is a Terminal?</em></a>) If the command is not found or it reports a number lower than <node-minimum></node-minimum>, you will need to <a href="https://nodejs.org/en/download/">download and install Node.js</a> before moving on to the next step.</p>
2020

2121
<p>Prefer to watch videos instead? Check out <a href="https://www.youtube.com/watch?v=kzf9A9tkkl4"><strong>6 minutes to Build a Blog from Scratch</strong></a>.</p>
2222

@@ -85,15 +85,44 @@ If you see `({% latestVersion versions, config %})` in your output you know you
8585
A <dfn>template</dfn> is a content file written in a [format such as Markdown, HTML, Liquid, Nunjucks, and more](/docs/languages/), which Eleventy transforms into a page (or pages) when building our site.
8686

8787
Let’s run two commands to create two new template files.
88+
</template>
8889

89-
```bash
90+
<script type="module" src="/js/seven-minute-tabs.js" webc:keep></script>
91+
<seven-minute-tabs class="tabs-full tabs-left" persist sync>
92+
<div role="tablist" aria-label="Choose your Operating System">
93+
<a href="#quickstart-os-nix" role="tab" data-tabs-persist="os:posix">macOS or Linux</a>
94+
<a href="#quickstart-os-win" role="tab" data-tabs-persist="os:win">Windows</a>
95+
<a href="#quickstart-os-all" role="tab" data-tabs-persist="os:all">Cross Platform</a>
96+
</div>
97+
<div id="quickstart-os-nix" role="tabpanel">
98+
<syntax-highlight language="bash">
9099
echo '<!doctype html><title>Page title</title><p>Hi</p>' > index.html
91-
```
92-
93-
```bash
94-
echo '# Page header' > README.md
95-
```
100+
</syntax-highlight>
101+
<syntax-highlight language="bash">
102+
echo '# Heading' > README.md
103+
</syntax-highlight>
104+
</div>
105+
<div id="quickstart-os-win" role="tabpanel">
106+
<syntax-highlight language="bash">
107+
echo '<!doctype html><title>Page title</title><p>Hi</p>' | out-file -encoding utf8 'index.html'
108+
</syntax-highlight>
109+
<syntax-highlight language="bash">
110+
echo '# Heading' | out-file -encoding utf8 'README.md'
111+
</syntax-highlight>
112+
<p>If the <code>out-file</code> command is not available in your Windows Terminal window, switch to use the Cross Platform method!</p>
113+
</div>
114+
<div id="quickstart-os-all" role="tabpanel">
115+
<syntax-highlight language="bash">
116+
npx @11ty/create index.html "<!doctype html><title>Page title</title><p>Hi</p>"
117+
</syntax-highlight>
118+
<syntax-highlight language="bash">
119+
npx @11ty/create README.md "# Heading"
120+
</syntax-highlight>
121+
<p>Learn more about <a href="https://github.com/11ty/create"><code>@11ty/create</code></a> <em>(requires Node.js 18 or newer)</em>.</p>
122+
</div>
123+
</seven-minute-tabs>
96124

125+
<template webc:type="11ty" 11ty:type="njk,md" webc:raw webc:nokeep>
97126
Alternatively, you can create these using any text editor—just make sure you save them into your project folder and they have the correct file extensions.
98127

99128
After you’ve created an HTML template and a Markdown template, let’s run Eleventy again with the following command:

src/docs/terminal-window.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,41 @@ eleventyNavigation:
66
excludeFromSidebar: true
77
---
88

9-
# Opening a Terminal Window
9+
# Opening a Terminal
1010

1111
{% tableofcontents %}
1212

13-
Eleventy runs in a [Terminal window](https://en.wikipedia.org/wiki/Terminal_emulator). If you’re not familiar with Terminal windows, they’re used to run typed commands (and programs) on your computer. A Terminal window is mostly synonymous with terms like Command Line Interface (CLI) or shell prompt.
13+
Eleventy runs in a [Terminal application](https://en.wikipedia.org/wiki/Terminal_emulator). If you’re not familiar with Terminal applications, they’re used to run typed commands (and programs) on your computer. A Terminal application is mostly synonymous with terms like Command Line Interface (CLI) or shell prompt.
1414

15-
Here’s how to open a Terminal window in various operating systems:
15+
Here’s how to open a Terminal in various operating systems:
1616

17-
## Mac OS
17+
## macOS
1818

19-
Mac OS includes an Application called `Terminal.app` which can be used to run Eleventy. Depending on your version of Mac OS, it may be in `/Applications/Utilities/Terminal.app`.
19+
macOS includes an application called `Terminal` which can be used to run Eleventy. Depending on your version of macOS, it likely lives in `/Applications/Utilities/Terminal`. It may also be called `Terminal.app` if your operating system is configured to show file extensions.
2020

2121
- [Open or quit Terminal on Mac on the _Apple Terminal User Guide_](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac)
2222

2323
## Windows
2424

25-
Depending on your version of Windows, it may include the `Terminal` App (aka Windows PowerShell), the `Command Prompt` (also known as `cmd.exe`), or both.
25+
Depending on your version of Windows, it may include the `Terminal` application (aka Windows PowerShell, preferred), or the `Command Prompt` (also known as `cmd.exe`, not preferred), or both.
2626

27-
## Popular Alternatives
27+
For the best terminal experience, we recommend installing [PowerShell Core](https://github.com/PowerShell/PowerShell) on your Windows machine, a newer and more future-compatible terminal application (also newly cross-platform!).
2828

29-
- [iTerm2](https://iterm2.com/) (Mac OS)
29+
## Linux
3030

31-
### Editors bundled with Terminals
31+
Depending on your flavor of Linux, it may be called `Terminal`, `Shell`, `Gnome Terminal`, `Konsole`, or `XTerm`.
3232

33-
- [Nova](https://nova.app/) (Mac OS)
34-
- [Visual Studio Code](https://code.visualstudio.com/) (Mac OS, Windows, Linux)
33+
## Editors
34+
35+
Some code editors bundle a terminal for you!
36+
37+
- [Nova](https://nova.app/) (macOS)
38+
- [Visual Studio Code](https://code.visualstudio.com/) (macOS, Windows, Linux)
3539
- On Windows, Visual Studio Code is bundled with Windows Powershell.
36-
- [WebStorm](https://www.jetbrains.com/webstorm/) (Mac OS, Windows, Linux)
40+
- [WebStorm](https://www.jetbrains.com/webstorm/) (macOS, Windows, Linux)
41+
42+
## More resources
43+
44+
- [DigitalOcean: An introduction to the Linux Terminal](https://www.digitalocean.com/community/tutorials/an-introduction-to-the-linux-terminal#terminal-emulator)
45+
- [Ubuntu guide: The Linux command line for beginners](https://ubuntu.com/tutorials/command-line-for-beginners#3-opening-a-terminal)
46+
- [OpenSource.com: A guide to the Linux terminal for beginners](https://opensource.com/article/21/8/linux-terminal)

0 commit comments

Comments
 (0)