From 768a4f7fd280f6e691ed9605012aef20db2e4a0e Mon Sep 17 00:00:00 2001 From: ZHANGYU Date: Tue, 9 Jul 2024 22:20:24 +0800 Subject: [PATCH] v3 --- README.md | 14 +++++++------- package.json | 8 ++++---- src/index.ts | 10 +++++++++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7983cac..269daa5 100644 --- a/README.md +++ b/README.md @@ -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) --- @@ -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 @@ -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}` diff --git a/package.json b/package.json index 1a64f5d..10803d2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tw-styled", "type": "module", - "version": "2.0.0", + "version": "3.0.0", "author": { "name": "zhangyu1818", "email": "hey@zhangyu.dev" @@ -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", diff --git a/src/index.ts b/src/index.ts index 5938adb..e2a5c79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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