Skip to content

Commit

Permalink
feat: support browser (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony authored Mar 10, 2023
1 parent 4739ef9 commit a80cb63
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Framework-agnostic vercel design's toast component

## Usage

### Bundler

```console
npm i vercel-toast
```
Expand All @@ -21,6 +23,21 @@ import { createToast } from "vercel-toast";
createToast("Hi from vercel toast!");
```

### Browser CDN

```html
<link
rel="stylesheet"
href="https://unpkg.com/vercel-toast/dist/vercel-toast.css"
/>

<script src="https://unpkg.com/vercel-toast"></script>

<script>
vercelToast.createToast("Hi from vercel toast!");
</script>
```

## Documentation

https://vercel-toast.vercel.app
Expand Down
16 changes: 9 additions & 7 deletions example/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

Framework-agnostic vercel design's toast component (≈1KB Gzipped).

## Use via bundler
## Usage

```bash
### Bundler

```console
npm i vercel-toast
```

```js
```ts
// in js file
import "vercel-toast/css";
// import "vercel-toast/dist/vercel-toast.css";
import { createToast } from "vercel-toast";

createToast("The Evil Rabbit jumped over the fence.");
createToast("Hi from vercel toast!");
```

## Use via CDN
### Browser CDN

```html
<link
Expand All @@ -27,7 +29,7 @@ createToast("The Evil Rabbit jumped over the fence.");
<script src="https://unpkg.com/vercel-toast"></script>

<script>
toast.createToast("The Evil Rabbit jumped over the fence.");
vercelToast.createToast("Hi from vercel toast!");
</script>
```

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"author": "2nthony <[email protected]> (https://github.com/2nthony)",
"main": "dist/vercel-toast.js",
"module": "dist/vercel-toast.mjs",
"browser": "dist/vercel-toast.global.js",
"types": "dist/vercel-toast.d.ts",
"exports": {
".": {
Expand All @@ -28,7 +29,7 @@
"test": "echo lol",
"example": "vite",
"example:build": "vite build",
"build": "tsup --entry.vercel-toast src/index.ts --dts --format esm,cjs",
"build": "tsup --entry.vercel-toast src/index.ts --dts --format esm,cjs,iife --minify --global-name=vercelToast",
"docs": "typedoc src/index.ts --out example/public/docs --mode file --readme none --theme minimal --excludeNotExported",
"build:docs": "npm run docs && npm run example:build",
"format": "prettier . --write",
Expand Down

1 comment on commit a80cb63

@vercel
Copy link

@vercel vercel bot commented on a80cb63 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vercel-toast – ./

vercel-toast.vercel.app
vercel-toast-git-master-2nthony.vercel.app
vercel-toast-2nthony.vercel.app

Please sign in to comment.