Skip to content

Commit d333b7b

Browse files
committed
Update browser setup
We are now using ESM.
1 parent 7f6858e commit d333b7b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

docs/modules/setup/pages/install.adoc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@ See below for a link to the right one and instructions on how to use it.
2323

2424
== Basic browser setup
2525

26-
Include Asciidoctor.js in a `<script>` tag.
27-
You can instantiate the processor using the `Asciidoctor` global variable.
26+
Import Asciidoctor.js in a `<script type="module">` tag.
27+
You can instantiate the processor using the `Asciidoctor()`.
2828

2929
```html
30-
<script src="node_modules/@asciidoctor/core/dist/browser/asciidoctor.js"></script>
31-
```
32-
```js
33-
var asciidoctor = Asciidoctor()
30+
<script type="module">
31+
import Asciidoctor from './node_modules/@asciidoctor/core/dist/browser/asciidoctor.js'
32+
const asciidoctor = Asciidoctor()
33+
</script>
3434
```
3535

36+
[NOTE]
37+
====
38+
You need to pay attention to local testing — if you try to load the HTML file locally (i.e. with a file:// URL), you'll run into CORS errors due to JavaScript module security requirements.
39+
You need to do your testing through a server.
40+
41+
Learn more about https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules[JavaScript modules].
42+
====
43+
3644
== Node
3745

3846
```js

0 commit comments

Comments
 (0)