Skip to content

Commit a06bc23

Browse files
addyosmaniXhmikosR
andauthored
Replace dead Glitch demos with self-hosted equivalents (#480)
* site: pass through src/demos for self-hosted demo pages Adds an addPassthroughCopy entry plus an .eleventyignore line so the new src/demos tree is copied verbatim into the build output without going through Nunjucks templating. * site: add self-hosted mini-ecomm demo A small two-variant store with a listing page and eight product pages, mirrored under mini-ecomm/ (no prefetching) and mini-ecomm-quicklink/ (quicklink.listen() loaded from the jsdelivr UMD bundle). Replaces the now-defunct mini-ecomm.glitch.me and mini-ecomm-quicklink.glitch.me apps that the demo and measure pages previously linked to. * site: add self-hosted SPA demo with route chunk prefetching A tiny vanilla-JS single-page app with a hand-rolled hash router and one ES-module chunk per route. Quicklink is configured with an hrefFn that maps each nav link to its chunk URL, so prefetching grabs the route's JavaScript instead of an HTML document. Uses the published quicklink.mjs from jsdelivr — no build step, runs on any static host. Replaces the create-react-app-quicklink.glitch.me demo referenced from demo.njk. * site: point demo and measure pages at self-hosted demos Replaces the dead mini-ecomm.glitch.me, mini-ecomm-quicklink.glitch.me and create-react-app-quicklink.glitch.me URLs with /demos/mini-ecomm/, /demos/mini-ecomm-quicklink/ and /demos/spa/. The WebPageTest scripting examples now use absolute getquick.link URLs and select the first .card anchor on the listing page. Fixes #469. * docs: drop dead Glitch links from READMEs Glitch shut down, so the news, news-workbox and spa demo READMEs (and the Demo section of the main README) all pointed at projects that no longer exist. Updates them to point at the self-hosted replacements under getquick.link/demos/, and keeps a short historical note in each legacy README so links to those folders still make sense. * lint: treat site/src/demos as ES modules The new SPA demo files use top-level import/export and a dynamic import() for route chunks, so eslint trips on them under the default sourceType: script and ecmaVersion: 2017. Adds a scoped override that parses site/src/demos as modules at ES2020, drops the strict-mode requirement (modules are implicitly strict), and disables max-len for the inline HTML template strings in the route chunks. * Drop emdashes --------- Co-authored-by: XhmikosR <xhmikosr@gmail.com>
1 parent 4e3449e commit a06bc23

36 files changed

Lines changed: 1493 additions & 58 deletions

.eslintrc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,18 @@ module.exports = {
8383
'strict': 'error',
8484
},
8585
},
86+
{
87+
files: [
88+
'site/src/demos/**',
89+
],
90+
parserOptions: {
91+
sourceType: 'module',
92+
ecmaVersion: 2020,
93+
},
94+
rules: {
95+
'strict': ['error', 'never'],
96+
'max-len': 'off',
97+
},
98+
},
8699
],
87100
};

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,17 @@ After installing `quicklink` as a dependency, you can use it as follows:
486486

487487
## Demo
488488

489-
### Glitch demos
489+
### Live demos
490+
491+
- [Mini-ecomm - without Quicklink](https://getquick.link/demos/mini-ecomm/) - vanilla multi-page store, no prefetching.
492+
- [Mini-ecomm - with Quicklink](https://getquick.link/demos/mini-ecomm-quicklink/) - same store, but Quicklink prefetches in-viewport product links.
493+
- [Single-page app](https://getquick.link/demos/spa/) - a small SPA that uses Quicklink to prefetch route-level JavaScript chunks.
494+
495+
The source for these demos lives under [`site/src/demos/`](https://github.com/GoogleChromeLabs/quicklink/tree/main/site/src/demos).
496+
497+
### Repo examples
490498

491-
- [Using Quicklink in a multi-page site](https://github.com/GoogleChromeLabs/quicklink/tree/main/demos/news)
492-
- [Using Quicklink with Service Workers (via Workbox)](https://github.com/GoogleChromeLabs/quicklink/tree/main/demos/news-workbox)
493499
- [Using Quicklink to prefetch API calls instead of `href` attribute](https://github.com/GoogleChromeLabs/quicklink/tree/main/demos/hrefFn)
494-
- [Using Quicklink to prerender a specific page](https://uskay-prerender2.glitch.me/next.html)
495500

496501
### Research
497502

demos/news-workbox/README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# Demo: Quicklink usage with workbox
1+
# Demo: Quicklink with Workbox
22

3-
A demo showing how to use Quicklink with Workbox for offline caching and links in the visible viewport.
3+
The original Glitch project that combined Quicklink with Workbox-based service
4+
workers is no longer available.
45

5-
## Glitch Source
6+
For an end-to-end Quicklink demo you can run today, see the self-hosted
7+
mini-ecomm and SPA demos:
68

7-
- [Link to Glitch App](https://anton-karlovskiy-quicklink-news-workbox.glitch.me)
8-
- [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news-workbox)
9+
- https://getquick.link/demos/mini-ecomm-quicklink/
10+
- https://getquick.link/demos/spa/
911

10-
## Installation
11-
12-
```sh
13-
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news-workbox
14-
npm install
15-
npm start
16-
npm run build
17-
```
12+
For Workbox itself, the up-to-date guides live at
13+
https://developer.chrome.com/docs/workbox. To layer Workbox runtime caching on
14+
top of Quicklink, register a service worker that caches navigations or static
15+
assets - Quicklink only triggers `<link rel="prefetch">`, so any caching
16+
strategy your service worker applies will continue to work as expected.

demos/news/README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
# Demo: Quicklink basic usage
1+
# Demo: Quicklink basic usage (multi-page site)
22

3-
A demo showing how to use Quicklink on a simple multi-page website.
3+
A demo showing how to use Quicklink on a multi-page website.
44

5-
## Glitch Source
5+
The original Glitch project for this demo is no longer available. A self-hosted
6+
replacement lives on the Quicklink site:
67

7-
- [Link to Glitch App](https://anton-karlovskiy-quicklink-news.glitch.me)
8-
- [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news)
8+
- **Live:** https://getquick.link/demos/mini-ecomm-quicklink/
9+
- **Source:** [`site/src/demos/mini-ecomm-quicklink`](../../site/src/demos/mini-ecomm-quicklink)
910

10-
## Installation
11-
12-
```sh
13-
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news
14-
npm install
15-
npm start
16-
npm run build
17-
```
11+
The unoptimized counterpart (no Quicklink) is at
12+
https://getquick.link/demos/mini-ecomm/, with source at
13+
[`site/src/demos/mini-ecomm`](../../site/src/demos/mini-ecomm). Use them
14+
side-by-side to compare navigation behavior.

demos/spa/README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
# Demo: Quicklink integration for create-react-app
1+
# Demo: Quicklink with a single-page app
22

3-
A demo showing how to use Quicklink with in a create-react-app site.
4-
To integrate your React SPA with Quicklink, follow the steps [here](https://github.com/GoogleChromeLabs/quicklink#single-page-apps-react).
3+
The original create-react-app Glitch project for this demo is no longer
4+
available. A self-hosted, framework-free SPA replacement lives on the Quicklink
5+
site:
56

6-
## Glitch Source
7+
- **Live:** https://getquick.link/demos/spa/
8+
- **Source:** [`site/src/demos/spa`](../../site/src/demos/spa)
79

8-
- [Link to Glitch App](https://create-react-app-quicklink.glitch.me/)
9-
- [Link to Project on Glitch](https://glitch.com/~create-react-app-quicklink)
10-
11-
## Installation
12-
13-
```sh
14-
git clone https://api.glitch.com/git/create-react-app-quicklink
15-
npm install
16-
npm start
17-
npm run build
18-
```
10+
The replacement uses a small hand-rolled hash router with one ES-module chunk
11+
per route. Quicklink is configured with an `hrefFn` that maps each link to its
12+
chunk URL, so prefetching grabs the route's JavaScript instead of an HTML
13+
document. The same pattern works in any SPA - see the
14+
[Single-page apps section](https://github.com/GoogleChromeLabs/quicklink#single-page-apps-react)
15+
of the main README for the React variant.

site/.eleventy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ module.exports = eleventyConfig => {
6464
eleventyConfig.addPassthroughCopy('src/assets/images');
6565
eleventyConfig.addPassthroughCopy('src/assets/js');
6666
eleventyConfig.addPassthroughCopy('src/site.webmanifest');
67+
eleventyConfig.addPassthroughCopy('src/demos');
6768

6869
eleventyConfig.addNunjucksFilter('markdown', string => {
6970
const md = new markdownIt();

site/.eleventyignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/demos

site/src/demo.njk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following waterfall shows a typical navigation for a site without Quicklink
3131

3232
To try the demo:
3333

34-
1. Open the [unoptimized site](https://mini-ecomm.glitch.me/) in Chrome.
34+
1. Open the [unoptimized site](/demos/mini-ecomm/) in Chrome.
3535
1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection.
3636
1. Pick **Galaxy S5** as a simulated device.
3737
1. Make sure **Disable cache** is not checked.
@@ -45,7 +45,7 @@ To try the demo:
4545

4646
Now, measure performance on the same site, that uses Quicklink:
4747

48-
1. Open the [optimized site](https://mini-ecomm-quicklink.glitch.me/) in Chrome.
48+
1. Open the [optimized site](/demos/mini-ecomm-quicklink/) in Chrome.
4949
1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection.
5050
1. Pick **Galaxy S5** as a simulated device.
5151
1. Make sure **Disable cache** is not checked.
@@ -87,7 +87,7 @@ Quicklink 2.0 includes support for React-based single-page-apps. This has been c
8787

8888
To try the demo:
8989

90-
1. Open the [optimized site](https://create-react-app-quicklink.glitch.me/) in Chrome.
90+
1. Open the [SPA demo](/demos/spa/) in Chrome.
9191
1. Open DevTools and go to the **Network** panel to simulate a **Fast 3G** Connection.
9292
1. Pick **Galaxy S5** as a simulated device.
9393
1. Make sure **Disable cache** is not checked.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<title>Mini Ecomm - Quicklink demo (with prefetching)</title>
7+
<meta name="description" content="Demo store for measuring Quicklink - this version uses Quicklink to prefetch in-viewport product links during idle time.">
8+
<meta name="robots" content="noindex">
9+
<link rel="stylesheet" href="style.css">
10+
</head>
11+
<body>
12+
<header>
13+
<a href="./">Mini Ecomm</a>
14+
<span class="badge">prefetching with Quicklink</span>
15+
</header>
16+
<main>
17+
<h1>New arrivals</h1>
18+
<p class="lede">Open DevTools → Network and watch in-viewport product links being prefetched at <code>Lowest</code> priority by <code>quicklink</code>. Compare with the <a href="../mini-ecomm/">unoptimized version</a>.</p>
19+
<div class="grid">
20+
<a class="card" href="product/1.html">
21+
<div class="thumb thumb-1">A</div>
22+
<div class="meta">
23+
<p class="title">Aurora Backpack</p>
24+
<p class="subtitle">Travel-ready 30L pack</p>
25+
<p class="price">$129</p>
26+
</div>
27+
</a>
28+
<a class="card" href="product/2.html">
29+
<div class="thumb thumb-2">B</div>
30+
<div class="meta">
31+
<p class="title">Beacon Sunglasses</p>
32+
<p class="subtitle">Polarized aviators</p>
33+
<p class="price">$89</p>
34+
</div>
35+
</a>
36+
<a class="card" href="product/3.html">
37+
<div class="thumb thumb-3">C</div>
38+
<div class="meta">
39+
<p class="title">Cascade Sneakers</p>
40+
<p class="subtitle">All-day running shoe</p>
41+
<p class="price">$145</p>
42+
</div>
43+
</a>
44+
<a class="card" href="product/4.html">
45+
<div class="thumb thumb-4">H</div>
46+
<div class="meta">
47+
<p class="title">Halcyon Watch</p>
48+
<p class="subtitle">Automatic dive watch</p>
49+
<p class="price">$499</p>
50+
</div>
51+
</a>
52+
<a class="card" href="product/5.html">
53+
<div class="thumb thumb-5">M</div>
54+
<div class="meta">
55+
<p class="title">Meridian Wallet</p>
56+
<p class="subtitle">Slim leather bifold</p>
57+
<p class="price">$59</p>
58+
</div>
59+
</a>
60+
<a class="card" href="product/6.html">
61+
<div class="thumb thumb-6">N</div>
62+
<div class="meta">
63+
<p class="title">Nimbus Hoodie</p>
64+
<p class="subtitle">Cloud-soft fleece</p>
65+
<p class="price">$79</p>
66+
</div>
67+
</a>
68+
<a class="card" href="product/7.html">
69+
<div class="thumb thumb-7">S</div>
70+
<div class="meta">
71+
<p class="title">Solstice Cap</p>
72+
<p class="subtitle">Five-panel canvas cap</p>
73+
<p class="price">$35</p>
74+
</div>
75+
</a>
76+
<a class="card" href="product/8.html">
77+
<div class="thumb thumb-8">V</div>
78+
<div class="meta">
79+
<p class="title">Vesper Headphones</p>
80+
<p class="subtitle">Active noise cancelling</p>
81+
<p class="price">$299</p>
82+
</div>
83+
</a>
84+
</div>
85+
</main>
86+
<script defer src="https://cdn.jsdelivr.net/npm/quicklink@3/dist/quicklink.umd.js"></script>
87+
<script>
88+
window.addEventListener('load', () => {
89+
quicklink.listen();
90+
});
91+
</script>
92+
</body>
93+
</html>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<title>Aurora Backpack - Mini Ecomm</title>
7+
<meta name="robots" content="noindex">
8+
<link rel="stylesheet" href="../style.css">
9+
</head>
10+
<body>
11+
<header>
12+
<a href="../">Mini Ecomm</a>
13+
<span class="badge">prefetching with Quicklink</span>
14+
</header>
15+
<main>
16+
<a class="back" href="../">← Back to listing</a>
17+
<article class="product">
18+
<div class="hero thumb-1">A</div>
19+
<div>
20+
<h1>Aurora Backpack</h1>
21+
<p class="price-tag">$129</p>
22+
<p class="description">A 30-liter daily commuter built for laptops up to 16″, with a weatherproof outer shell and a magnetic-strap closure. Padded shoulder straps distribute weight across long days, and the back panel has a luggage pass-through for travel.</p>
23+
<ul class="specs">
24+
<li><span>Capacity</span><span>30 L</span></li>
25+
<li><span>Material</span><span>1000D recycled nylon</span></li>
26+
<li><span>Weight</span><span>1.1 kg</span></li>
27+
<li><span>Warranty</span><span>Lifetime</span></li>
28+
</ul>
29+
<a class="buy" href="#">Add to cart</a>
30+
</div>
31+
</article>
32+
</main>
33+
</body>
34+
</html>

0 commit comments

Comments
 (0)