Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyu1818 committed Jul 9, 2024
1 parent bfeab92 commit 768a4f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![npm-version](https://img.shields.io/npm/v/tw-styled.svg)
[![codecov](https://codecov.io/gh/zhangyu1818/tw-styled/graph/badge.svg?token=Ds8VpqzAwG)](https://codecov.io/gh/zhangyu1818/tw-styled)
![npm bundle size](https://deno.bundlejs.com/badge?q=tw-styled@2.0.0)
![npm bundle size](https://deno.bundlejs.com/badge?q=tw-styled@3.0.0)

---

Expand All @@ -23,23 +23,23 @@ Before using `tw-styled`, ensure that Tailwind CSS is properly integrated into y
Install `tw-styled` via npm:

```bash
npm install tw-styled
npm install tw-styled tailwind-merge
```

If you need to use `tw-styled` with built-in classnames merge functionality, you should install the `tailwind-merge` package:
If you need to use `tw-styled` with a customized merge function without installing the `tailwind-merge` package:

```bash
npm install tw-styled tailwind-merge
npm install tw-styled
```

## Getting Started

### Using `tw-styled` with built-in merge functionality

Start by importing the `tw` function from `tw-styled/merge`:
Start by importing the `tw` function from `tw-styled`:

```javascript
import { tw } from 'tw-styled/merge'
import { tw } from 'tw-styled'
```

### Creating Components with Tailwind CSS
Expand Down Expand Up @@ -79,7 +79,7 @@ function App() {
### Using `tw-styled` with custom classnames merge functionality

```javascript
import { create } from 'tw-styled'
import { create } from 'tw-styled/create'

const merge = (classNames, propsClassNames) =>
`${classNames} ${propsClassNames}`
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tw-styled",
"type": "module",
"version": "2.0.0",
"version": "3.0.0",
"author": {
"name": "zhangyu1818",
"email": "[email protected]"
Expand All @@ -13,9 +13,9 @@
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./merge": {
"types": "./dist/merge.d.ts",
"import": "./dist/merge.js"
"./create": {
"types": "./dist/styled.d.ts",
"import": "./dist/styled.js"
}
},
"main": "dist/index.js",
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export { create } from './styled'
import { twMerge } from 'tailwind-merge'

import { create } from './styled'

const tw = create(twMerge)

export { tw }

export default tw

0 comments on commit 768a4f7

Please sign in to comment.