From 81a0f80ee1e42bd50c5affa64059cd1d129c9529 Mon Sep 17 00:00:00 2001 From: Tim Scanlin Date: Wed, 24 Apr 2024 15:05:37 -0700 Subject: [PATCH] add default to . export and update readme --- README.md | 15 +++++++++++++-- package.json | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac029457..a0d2e72e 100644 --- a/README.md +++ b/README.md @@ -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 - + ``` @@ -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 - + ``` OR diff --git a/package.json b/package.json index f294915d..4c9a432c 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "exports": { ".": { "import": "./index.js", + "default": "./index.js", "types": "./index.d.ts" }, "./styles.css": "./dist/styles.css",