Skip to content

Commit

Permalink
Update browser setup
Browse files Browse the repository at this point in the history
We are now using ESM.
  • Loading branch information
ggrossetie authored Jun 2, 2024
1 parent 4849126 commit 995f2fb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions docs/modules/setup/pages/install.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@ See below for a link to the right one and instructions on how to use it.

== Basic browser setup

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

```html
<script src="node_modules/@asciidoctor/core/dist/browser/asciidoctor.js"></script>
```
```js
var asciidoctor = Asciidoctor()
<script type="module">
import Asciidoctor from './node_modules/@asciidoctor/core/dist/browser/asciidoctor.js'
const asciidoctor = Asciidoctor()
</script>
```

[NOTE]
====
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.
You need to do your testing through a server.
Learn more about https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules[JavaScript modules].
====

== Node

```js
Expand Down

0 comments on commit 995f2fb

Please sign in to comment.