Skip to content
Open
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
Binary file added react-tailwind-fast/.codesandbox/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions react-tailwind-fast/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "pnpm install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"dev": {
"name": "dev",
"command": "pnpm dev",
"runAtStart": true,
"preview": {
"port": 5173
}
},
"build": {
"name": "build",
"command": "pnpm build",
"runAtStart": false
},
"preview": {
"name": "preview",
"command": "pnpm preview",
"runAtStart": false
},
"install": {
"name": "install dependencies",
"command": "pnpm install"
}
}
}
7 changes: 7 additions & 0 deletions react-tailwind-fast/.codesandbox/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "React Tailwind Fast",
"description": "Fast React template with UnoCSS (Tailwind preset) in browser. Uses Vite on the server, and create-react-app in the browser.",
"iconUrl": "https://raw.githubusercontent.com/codesandbox/sandbox-templates/main/react-tailwind-fast/.codesandbox/icon.png",
"tags": ["frontend", "react", "vite", "javascript", "typescript", "tailwind", "unocss"],
"published": true
}
4 changes: 4 additions & 0 deletions react-tailwind-fast/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Devcontainer",
"image": "ghcr.io/codesandbox/devcontainers/typescript-node:latest"
}
18 changes: 18 additions & 0 deletions react-tailwind-fast/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
24 changes: 24 additions & 0 deletions react-tailwind-fast/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
29 changes: 29 additions & 0 deletions react-tailwind-fast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# React + Tailwind Fast

This template provides a minimal setup to get React working super fast in CodeSandbox's browser environment while retaining Tailwind CSS capabilities.

## Notes & Arrangement

Normally, a React + TailwindCSS template relies heavily on the PostCSS plugins, which require running a backend-based Sandbox (a Devbox VM). That can take some time to start and refresh.
To give you an instant-refresh experience, this template uses **UnoCSS**. UnoCSS has an out-of-the-box Tailwind preset (`@unocss/preset-uno`) which acts as a drop-in replacement for Tailwind but is faster and simpler to run inside the CodeSandbox standard browser bundler.

- Instant spin-up in the browser
- Tailwind syntax fully supported via UnoCSS
- Powered by Vite
- Fully Typed via TypeScript

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
```
13 changes: 13 additions & 0 deletions react-tailwind-fast/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<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 + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions react-tailwind-fast/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "react-tailwind-fast",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.16.0",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"typescript": "^5.7.2",
"unocss": "^0.65.0",
"vite": "^6.0.3"
}
}
Loading