Skip to content

Commit

Permalink
add default to . export and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tscanlin committed Apr 24, 2024
1 parent c929e37 commit 81a0f80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Expand Up @@ -24,12 +24,23 @@ Install it with npm.
npm install --save tocbot
```

Then use with either commonjs or ESM imports:

```js
const tocbot = require('tocbot/dist/tocbot.js')
// OR
import tocbot from 'tocbot'

// Initialize tocbot
tocbot.init()
```

OR

Include the script at the bottom of the page before the closing body tag.

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.27.4/tocbot.min.js"></script>
```


Expand All @@ -38,7 +49,7 @@ Include the script at the bottom of the page before the closing body tag.
CSS is used for expanding & collapsing groupings and some basic styling.

```html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.27.4/tocbot.css">
```

OR
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -7,6 +7,7 @@
"exports": {
".": {
"import": "./index.js",
"default": "./index.js",
"types": "./index.d.ts"
},
"./styles.css": "./dist/styles.css",
Expand Down

0 comments on commit 81a0f80

Please sign in to comment.