Skip to content

Commit d1c86cb

Browse files
committed
Fix up demo links. Add back-to-main-page links from demos
1 parent d96621d commit d1c86cb

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# JSON/CSS Module notes
2-
JSON and CSS modules provide several ergonomic benefits for web component developers. They provide easy integration into the JavaScript module graph with automatic deduping of dependencies, and eliminate the need to manually manage `fetch()`es or pollute the DOM with extra `<style>` and `<link rel="stylesheet">` elements.
2+
[JSON modules](https://github.com/whatwg/html/pull/4407) and [CSS modules](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/css-modules-v1-explainer.md) provide several ergonomic benefits for web component developers. They provide easy integration into the JavaScript module graph with automatic deduping of dependencies, and eliminate the need to manually manage `fetch()`es or pollute the DOM with extra `<style>` and `<link rel="stylesheet">` elements.
33

44
However, there are also important quantitative performance advantages to JSON and CSS modules over the current equivalents. This document describes these advantages and illustrates them with code samples.
55

@@ -63,9 +63,10 @@ With JSON modules, on the other hand, browsers can initiate
6363
the fetch for a JSON file as soon as the importing module is parsed, prior to module linking or execution. [Demo 1](#Demo-1) illustrates this difference.
6464

6565
## Demo 1
66-
### Fetches for JSON and CSS modules starts before script execution
67-
https://dandclark.github.io/json-css-module-notes/demo1/index.html
68-
(the JSON modules demo requires Chrome or Edge launched with --enable-blink-features=JSONModules)
66+
### [Fetches for JSON and CSS modules starts before script execution](https://dandclark.github.io/json-css-module-notes/demo1/index.html)
67+
[https://dandclark.github.io/json-css-module-notes/demo1/index.html](https://dandclark.github.io/json-css-module-notes/demo1/index.html)
68+
69+
(The JSON modules demo requires Chrome or Edge launched with --enable-blink-features=JSONModules).
6970

7071
This demo compares two similar custom elements written as a JavaScript module, each of which requires a JSON resource. The first custom element consumes the JSON by `fetch()`ing it, and the second by `import`ing it as a module. For both custom elements, an additional `busyWork.js` module is included in the module graph before the module containing the custom element definition. This is a stand-in for any arbitrary script that might appear in the module graph prior to the custom element definition, such as a JavaScript libary.
7172

@@ -78,8 +79,10 @@ In the `fetch()` version of the custom element, the JSON file isn't fetched unti
7879
![With JSON module](demo1Module.PNG)
7980

8081
## Demo 2
81-
### CSS modules vs <link> elements in shadow roots
82-
https://dandclark.github.io/json-css-module-notes/demo2/index.html
82+
### [CSS modules vs `<link>` elements in shadow roots](https://dandclark.github.io/json-css-module-notes/demo2/index.html)
83+
[https://dandclark.github.io/json-css-module-notes/demo2/index.html](https://dandclark.github.io/json-css-module-notes/demo2/index.html)
84+
85+
(There is no general CSS modules browser support as of this writing; that part of the demo was developed on a custom Chromium build).
8386

8487
This demo compares two similar custom elements written as a JavaScript module, each of which loads its styles from a separate `styles.css` file. The first custom element applies its styles by adding the styles via a `<link rel="stylesheet">` in the custom element shadow root. The second loads its styles via a CSS module.
8588

demo1/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ <h2>Demo 1: Fetching of JSON and CSS modules starts before script execution</h2>
33
<ul>
44
<li><a href="./noModule.html">With manual fetch()</a></li>
55
<li><a href="./module.html">With JSON Module</a> (works in Chromium-based browsers launched with --enable-blink-features=JSONModules command-line flag)</li>
6-
</ul>
6+
</ul>
7+
<br>
8+
<a href="../">[Back to main page]</a>

demo2/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ <h2>Demo 1: Fetching of JSON and CSS modules starts before script execution</h2>
44
<li><a href="./noModule.html">With &lt;link rel="stylesheet"&gt; in shadow root</a></li>
55
<li><a href="./module.html">With CSS Module</a> (no browser support yet...)</li>
66
</ul>
7+
<a href="../">[Back to main page]</a>

0 commit comments

Comments
 (0)