Skip to content

Commit

Permalink
feat(tailwind): ✨ add tailwind config module
Browse files Browse the repository at this point in the history
  • Loading branch information
recallwei committed Jun 19, 2024
1 parent 6d9b43e commit 24b42d8
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
![npm](https://img.shields.io/npm/v/@bit-ocean/eslint-config?logo=eslint&label=eslint-config)
![npm](https://img.shields.io/npm/v/@bit-ocean/prettier-config?logo=prettier&label=prettier-config)
![npm](https://img.shields.io/npm/v/@bit-ocean/renovate-config?logo=renovatebot&label=renovate-config)
![npm](https://img.shields.io/npm/v/@bit-ocean/tailwind?logo=tailwindcss&label=tailwind)
![npm](https://img.shields.io/npm/v/@bit-ocean/tsconfig?logo=typescript&label=tsconfig)

## Packages
Expand All @@ -26,11 +27,11 @@
- [`hooks`](/packages/hooks/README.md): Universal hooks.
- [`i18n`](/packages/i18n/README.md): Universal i18n instance for React projects.
- [`prettier-config`](/packages/prettier-config/README.md): Universal Prettier configuration.
- [`tailwind-config`](/packages/tailwind-config/README.md): Universal Tailwind CSS configuration.
- [`renovate-config`](/packages/renovate-config/README.md): Universal Renovate configuration.
- [`tailwind`](/packages/tailwind/README.md): Universal Tailwind CSS configuration.
- [`tanstack-query`](/packages/tanstack-query/README.md): Universal Tanstack Query instance and plugins.
- [`theme`](/packages/theme/README.md): Universal theme configuration.
- [`tsconfig`](/packages/tsconfig/README.md): Universal tsconfig for TypeScript projects.
- [`renovate-config`](/packages/renovate-config/README.md): Universal Renovate configuration.
- [`utils`](/packages/utils/README.md): Utility functions, types.

## License
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"dependencies": {
"prettier-plugin-astro": "^0.14.0",
"prettier-plugin-tailwindcss": "^0.6.4"
"prettier-plugin-tailwindcss": "^0.6.5"
},
"publishConfig": {
"access": "public"
Expand Down
31 changes: 31 additions & 0 deletions packages/tailwind/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# @bit-ocean/tailwind

![npm](https://img.shields.io/npm/v/@bit-ocean/tailwind?logo=tailwindcss&label=tailwind)

> Universal Tailwind CSS configuration.
## Installation

```bash
pnpm add -D tailwindcss postcss autoprefixer @bit-ocean/tailwind
npx tailwindcss init -p
```

## Configuration

Add the following styles to your `src/styles/index.scss` or global styles file:

```scss
@tailwind base;
@tailwind components;
@tailwind utilities;
```

Then add the following tailwind config presets to your `tailwind.config.js`:

```js
module.exports = {
presets: [require('@raipiot-infra/tailwind/preset')],
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}']
}
```
40 changes: 40 additions & 0 deletions packages/tailwind/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@bit-ocean/tailwind",
"version": "0.0.28",
"description": "Universal Tailwind CSS configuration.",
"author": "Bruce Song <[email protected]> (https://github.com/recallwei/)",
"homepage": "https://github.com/bit-ocean-studio/infra#readme",
"bugs": "https://github.com/bit-ocean-studio/infra/issues",
"repository": {
"type": "git",
"url": "https://github.com/bit-ocean-studio/infra.git",
"directory": "packages/tailwind"
},
"keywords": [
"bit-ocean",
"bit-ocean-infra",
"tailwind",
"tailwind-config"
],
"files": [
"tailwind.config.ts"
],
"exports": {
".": "./tailwind.config.ts"
},
"scripts": {
"type:check": "tsc --pretty --noEmit",
"cspell:check": "cspell --no-progress --show-suggestions --show-context --cache **",
"eslint:check": "eslint . --color --cache",
"eslint:fix": "eslint . --color --cache --fix",
"prettier:check": "prettier --check --cache --ignore-unknown --ignore-path=../../.prettierignore .",
"prettier:fix": "prettier --write --cache --ignore-unknown --ignore-path=../../.prettierignore ."
},
"peerDependencies": {
"tailwindcss": "^3.4.4"
},
"publishConfig": {
"access": "public"
},
"license": "MIT"
}
10 changes: 10 additions & 0 deletions packages/tailwind/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Config } from 'tailwindcss'

const config: Omit<Config, 'content'> = {
theme: {
extend: {}
},
plugins: [],
darkMode: ['class', '[data-theme="dark"]']
}
export default config
4 changes: 4 additions & 0 deletions packages/tailwind/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@bit-ocean/tsconfig/base",
"include": ["tailwind.config.ts"]
}
16 changes: 11 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 24b42d8

Please sign in to comment.