Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: setup tailwind, and build css #5

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
# production
/build
/dist
src/styles/tailwind.output.css

# Storybook
storybook-static
*storybook.log

# lock file
# yarn
yarn.lock
.yarn

# misc
.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.1.cjs
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"dist"
],
"scripts": {
"build": "tsup",
"build:css": "tailwindcss -i src/styles/tailwind.css -o src/styles/tailwind.output.css --minify",
"watch:css": "tailwindcss -i src/styles/tailwind.css -o src/styles/tailwind.output.css --watch",
"dev": "concurrently \"yarn watch:css\" \"yarn storybook\"",
"build": "yarn build:css && tsup",
"clean": "rm -rf dist",
"dev": "tsup --watch",
"test": "jest",
"prepublishOnly": "npm run build",
"storybook": "storybook dev -p 6006",
Expand All @@ -37,12 +39,17 @@
"@testing-library/react": "^16.0.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8.4.38",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"storybook": "^8.1.10",
"tailwindcss": "^3.4.4",
"tsup": "^8.1.0",
"typescript": "^5.5.2"
}
},
"packageManager": "[email protected]"
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
1 change: 1 addition & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// src/components/Button/Button.tsx

import React from 'react';
import '../../styles/tailwind.output.css';

export interface ButtonProps {
label: string;
Expand Down
3 changes: 3 additions & 0 deletions src/styles/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
9 changes: 9 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
}

2 changes: 2 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
outDir: 'dist',
dts: true,
splitting: false,
sourcemap: true,
clean: true,
external: ['react', 'react-dom'],
injectStyle: true,
});