Skip to content

Commit

Permalink
feat: add tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
ettysekhon committed Jan 1, 2023
1 parent dc97ed8 commit c8e1b50
Show file tree
Hide file tree
Showing 41 changed files with 1,514 additions and 434 deletions.
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `Turborepo` Vite starter
# `Turborepo` Vite & Tailwind starter

This is an official starter Turborepo.

Expand All @@ -8,18 +8,35 @@ This Turborepo includes the following packages and apps:

### Apps and Packages

- `docs`: a vanilla [vite](https://vitejs.dev) ts app
- `web`: another vanilla [vite](https://vitejs.dev) ts app
- `ui`: a stub component & utility library shared by both `web` and `docs` applications
- `web`: a react [vite](https://vitejs.dev) ts app with [Tailwind CSS](https://tailwindcss.com/)
- `ui`: a stub React component library with [Tailwind CSS](https://tailwindcss.com/) shared by `web`
- `eslint-config-custom`: shared `eslint` configurations
- `tsconfig`: `tsconfig.json`s used throughout the monorepo

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/).

### Building packages/ui

This example is setup to build `packages/ui` and output the transpiled source and compiled styles to `dist/`. This was chosen to make sharing one `tailwind.config.js` as easy as possible, and to ensure only the CSS that is used by the current application and its dependencies is generated.

Another option is to consume `packages/ui` directly from source without building. If using this option, you will need to update your `tailwind.config.js` to be aware of your package locations, so it can find all usages of the `tailwindcss` class names.

For example, in [tailwind.config.js](packages/tailwind-config/tailwind.config.js):

```js
content: [
// app content
`src/**/*.{js,ts,jsx,tsx}`,
// include packages if not transpiling
"../../packages/**/*.{js,ts,jsx,tsx}",
],
```

### Utilities

This Turborepo has some additional tools already setup for you:

- [Tailwind CSS](https://tailwindcss.com/) for styles
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Jest](https://jestjs.io) test runner for all things JavaScript
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/.eslintrc.cjs

This file was deleted.

15 changes: 0 additions & 15 deletions apps/docs/favicon.svg

This file was deleted.

13 changes: 0 additions & 13 deletions apps/docs/index.html

This file was deleted.

22 changes: 0 additions & 22 deletions apps/docs/package.json

This file was deleted.

1 change: 0 additions & 1 deletion apps/docs/public/vite.svg

This file was deleted.

20 changes: 0 additions & 20 deletions apps/docs/src/main.ts

This file was deleted.

97 changes: 0 additions & 97 deletions apps/docs/src/style.css

This file was deleted.

1 change: 0 additions & 1 deletion apps/docs/src/typescript.svg

This file was deleted.

1 change: 0 additions & 1 deletion apps/docs/src/vite-env.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions apps/docs/tsconfig.json

This file was deleted.

15 changes: 0 additions & 15 deletions apps/web/favicon.svg

This file was deleted.

7 changes: 3 additions & 4 deletions apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
<title>Admin | Kitchen Sink</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
14 changes: 12 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --host 0.0.0.0 --port 3001 --clearScreen false",
"build": "tsc && vite build",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"preview": "vite preview",
"lint": "TIMING=1 eslint \"src/**/*.ts\""
"lint": "tsc --noEmit && TIMING=1 eslint \"src/**/*.ts*\""
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^3.0.0",
"autoprefixer": "^10.4.13",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"postcss": "^8.4.20",
"tailwind-config": "workspace:*",
"tailwindcss": "^3.2.4",
"tsconfig": "workspace:*",
"typescript": "^4.9.4",
"vite": "^4.0.3"
Expand Down
Binary file added apps/web/public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion apps/web/public/vite.svg

This file was deleted.

40 changes: 40 additions & 0 deletions apps/web/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
max-width: 100%;
margin: 0 auto;
padding: 0 16px;
text-align: center;
}

.title {
font-size: 3rem;
font-weight: 700;
margin: 0;
}

.title span {
display: inline-block;
background-image: linear-gradient(to right, #3b82f6, #ef4444);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}

.description {
color: #9ca3af;
font-weight: 500;
}

.description a {
color: #3b82f6;
text-decoration: none;
}

.description a:hover {
text-decoration: underline;
}
19 changes: 19 additions & 0 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Button } from "ui";

function App() {
return (
<main className="mx-auto w-auto px-4 pt-16 pb-8 sm:pt-24 lg:px-8">
<h1 className="mx-auto max-w-5xl text-center text-6xl font-extrabold leading-[1.1] tracking-tighter text-white sm:text-7xl lg:text-8xl xl:text-8xl">
Web <br className="hidden lg:block" />
<span className="inline-block bg-gradient-to-r from-brandred to-brandblue bg-clip-text text-transparent">
Turborepo Example
</span>{" "}
</h1>
<div className="mx-auto mt-5 max-w-xl sm:flex sm:justify-center md:mt-8">
<Button />
</div>
</main>
);
}

export default App;
20 changes: 0 additions & 20 deletions apps/web/src/main.ts

This file was deleted.

13 changes: 13 additions & 0 deletions apps/web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import ReactDOM from "react-dom";
import "./styles/globals.css";
// include styles from the ui package
import "ui/styles.css";
import App from "./App";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
Loading

0 comments on commit c8e1b50

Please sign in to comment.