Skip to content

Commit

Permalink
Clarify how to use with bundler properly
Browse files Browse the repository at this point in the history
  • Loading branch information
srcrip committed Dec 18, 2024
1 parent 13c9428 commit cef23f7
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ def deps do
end
```

Next open up your `app.js` and import/setup the hook (Note that if you bundle through some external bundler, you may need to import from `../deps/live_toast`):
Next open up your `app.js` and import/setup the hook.

If you have a `package.json` file at the top of `assets`, you can add this to it:

```json
"dependencies": {
"live_toast": "file:../deps/live_toast",
},
```

And then import and set up the bare module:

```javascript
import { createLiveToastHook } from 'live_toast'
Expand All @@ -44,6 +54,19 @@ let liveSocket = new LiveSocket('/live', Socket, {
})
```

Or you can import the file directly:

```javascript
// this path would be relative to where your app.js happens to be.
import { createLiveToastHook } from '../deps/live_toast'

let liveSocket = new LiveSocket('/live', Socket, {
hooks: {
LiveToast: createLiveToastHook()
}
})
```

Then, add `'../deps/live_toast/lib/**/*.*ex'` to your list of paths Tailwind will look for class names, in your
`tailwind.config.js`:

Expand Down

0 comments on commit cef23f7

Please sign in to comment.