集成 Vite、@vitejs/plugin-react 与 Tailwind CSS v4(通过 @tailwindcss/vite)
vite-react-tailwind-lint — Vite 启动器模板
作者 marcop135
一个预配置 ESLint、Stylelint、HTMLHint、Prettier、Vitest、Testing Library、Husky 及 GitHub Actions 发布流程的 Vite + React + Tailwind CSS 起步模板。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
预配置 ESLint(含 react、react-hooks、react-refresh 插件)、Stylelint、HTMLHint 和 Prettier(含 Tailwind 插件)
使用 Vitest(jsdom 环境,支持 UI 与覆盖率模式)和 Testing Library 进行测试
通过 Husky + lint-staged 设置预提交检查
包含 GitHub Actions CI、标签驱动发布、每两周补丁发布及 Dependabot 自动合并工作流
提供部署工作流,通过 SFTP 或 FTPS 将 dist/ 镜像到 FTP 根目录并清除 Cloudflare 缓存
模板详细介绍
该模板面向希望快速开始一个较小规模 React 应用、又不想手动配置代码检查、格式化、测试和发布流水线的开发者。README 明确列出已集成 Vite、@vitejs/plugin-react、Tailwind CSS v4(通过 @tailwindcss/vite),以及 ESLint(含 react、react-hooks、react-refresh 插件)、Stylelint、HTMLHint、Prettier(含 prettier-plugin-tailwindcss)、Vitest(jsdom 环境,支持 UI 与覆盖率模式)、Testing Library、Husky + lint-staged 预提交钩子。GitHub Actions 覆盖 CI、标签驱动的发布、每两周补丁发布,以及 Dependabot 补丁/次版本自动合并和范围内 npm update 自动合并。
项目结构在 README 中有说明:src/ 包含组件、测试设置、入口与 Tailwind 指令样式文件,public/ 存放原样复制到 dist/ 的静态资源(含 .htaccess、隐私页、404 页、matomo.js),scripts/ 含发布辅助脚本与版本锁定脚本。配置分散在 eslint.config.js、.stylelintrc、.htmlhintrc、prettier.config.mjs、vitest.config.js、.editorconfig、.nvmrc、.lintstagedrc.js 等文件中。
部署方面,README 说明站点托管在 Netsons 并置于 Cloudflare 之后,deploy.yml 在推送到 main 或手动触发时执行测试、构建、通过 SFTP 或 FTPS 将 dist/ 镜像到 FTP 根目录,然后清除 Cloudflare 缓存。public/.htaccess 设置 SPA 回退、安全头、CSP 和缓存。分析使用自托管、无 Cookie 的 Matomo,由 public/matomo.js 加载;使用模板时应删除该文件及 index.html 中的对应 script 标签。
限制与未说明事项:README 未提供模板的视觉设计细节、页面功能清单或生产就绪程度说明;预览截图仅证明存在桌面与移动端截图,不证明页面功能。Node.js 要求为 v22.22.2+,且 README 称 Vite 8 设定了该下限。发布流程依赖 develop 与 main 分支约定及标签,具体操作需按 README 的发布章节执行。
适合你的项目吗?
适用场景
- 需要快速启动一个带有代码检查、格式化和测试配置的 React 小应用
- 希望使用 Tailwind CSS v4 并已配置好相关构建与格式化插件
- 需要预置 GitHub Actions CI 与标签发布流程的项目
- 需要将静态构建产物通过 FTP 部署并配合 Cloudflare 缓存清除的站点
适合人群
- 希望减少初始工具链配置时间的 React 开发者
- 需要标准化代码检查与测试流程的小型前端项目
- 使用 GitHub Actions 进行 CI 和发布管理的团队
- 使用 Tailwind CSS v4 并需要 Prettier 自动排序类名的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
克隆仓库后运行 npm install,再运行 npm run dev 启动开发服务器(默认 http://localhost:5173)
- 2
需要 Node.js v22.22.2+,.nvmrc 固定了 22 系列,可使用 nvm use
- 3
使用模板时应删除 public/matomo.js 及 index.html 中对应的 script 标签,以移除自托管 Matomo 分析
- 4
部署工作流依赖 GitHub Actions 中的 FTP/SFTP 凭据与 Cloudflare 缓存清除配置,README 未展开具体密钥设置
- 5
发布流程依赖 develop 与 main 分支约定及版本标签,具体步骤见 README 的 Releases 章节
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 部署工作流依赖 Netsons 主机、Cloudflare 及 SFTP/FTPS 凭据;README 未展开具体密钥设置,需自行配置。
- 站点分析使用自托管、无 Cookie 的 Matomo,由 public/matomo.js 加载;使用模板时应删除该文件及 index.html 中对应 script 标签。
- 需要 Node.js v22.22.2+(.nvmrc 固定 22 系列),README 称 Vite 8 设定了该下限。
- 自动化流程(Husky 预提交、GitHub Actions CI、标签发布、每两周补丁发布、Dependabot 自动合并)依赖 GitHub 仓库与分支约定。
- 发布流程依赖 develop 与 main 分支约定及 vX.Y.Z 标签,需按 README 的 Releases 章节执行。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
The site at [vitereact.marcopontili.com](https://vitereact.marcopontili.com) is hosted on Netsons behind Cloudflare. `.github/workflows/deploy.yml` runs on every push to `main` (or a manual dispatch from `main`): it tests, builds, mirrors `dist/` to the FTP root over SFTP or FTPS, then purges the Cloudflare cache for the host. `public/.htaccess` sets the SPA fallback, security headers, CSP and caching. Analytics is a self-hosted, cookieless Matomo loaded from `public/matomo.js`; delete that file and its `<script>` tag in `index.html` when you use the starter.
README 原文
The site at [vitereact.marcopontili.com](https://vitereact.marcopontili.com) is hosted on Netsons behind Cloudflare. `.github/workflows/deploy.yml` runs on every push to `main` (or a manual dispatch from `main`): it tests, builds, mirrors `dist/` to the FTP root over SFTP or FTPS, then purges the Cloudflare cache for the host. `public/.htaccess` sets the SPA fallback, security headers, CSP and caching. Analytics is a self-hosted, cookieless Matomo loaded from `public/matomo.js`; delete that file and its `<script>` tag in `index.html` when you use the starter.
README 原文
- [Node.js](https://nodejs.org/en) v22.22.2+ (the 22 line is pinned in `.nvmrc`, run `nvm use`); Vite 8 sets that floor
README 原文
- **Automation:** Husky + lint-staged pre-commit, GitHub Actions for CI, tag-driven releases, biweekly patch releases, auto-merge for Dependabot patch/minor and the biweekly in-range `npm update`
README 原文
https://github.com/marcop135/vite-react-tailwind-lint/blob/main/LICENSEhttps://github.com/marcop135/vite-react-tailwind-lint/blob/main/README.mdChanges land on `develop`, then a release commit (`chore(release): vX.Y.Z`) merges to `develop`, the merge is tagged `vX.Y.Z`, and `main` is merged up from `develop`. The `release.yml` workflow then runs `release:check` against the tag and publishes a GitHub Release whose body is built from `CHANGELOG.md` by `scripts/release-notes-from-changelog.mjs`.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-18。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 85 / 100
- 技术栈
- Vite · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-17
- 截图检查日期
- 2026-10-18
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Vite。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: codex-user-requested-batch-review-20261021 · 2026-10-21
查看当时使用的来源资料
SHA-256: db06e59283e82c7fa12dd56a6d2e658253599abe2e6422202db0c009465ef86d
2026-10-18T22:47:51.024Z
来源文件 / 仓库<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/brand/readme-dark.png" />
<source media="(prefers-color-scheme: light)" srcset=".github/brand/readme.png" />
<img src=".github/brand/readme.png" alt="Vite logo tile, the name Vite + React + Tailwind and the line React, Tailwind and Vite, already linted and tested, beside stacked Tailwind CSS, React and Vite planes" width="900" />
</picture>
</p>
# Vite + React + Tailwind CSS Starter
[](https://github.com/marcop135/vite-react-tailwind-lint/actions/workflows/ci.yml)
[](https://github.com/marcop135/vite-react-tailwind-lint/releases)
[](./LICENSE)
A [Vite](https://vitejs.dev/) starter for React + Tailwind CSS with linting, formatting, tests, and a tagged-release pipeline already wired up. Site: [vitereact.marcopontili.com](https://vitereact.marcopontili.com).
Use this when you want a small React app and you do not want to spend half a day configuring ESLint, Stylelint, HTMLHint, Prettier, Vitest, Testing Library, Husky, and a release workflow yourself.
## Quick start
```bash
git clone https://github.com/marcop135/vite-react-tailwind-lint.git my-app
cd my-app && npm install
npm run dev
```
Dev server runs on `http://localhost:5173`.
## What's included
- **Build:** Vite, [`@vitejs/plugin-react`](https://github.com/vitejs/vite-plugin-react), [Tailwind CSS v4](https://tailwindcss.com/) via [`@tailwindcss/vite`](https://tailwindcss.com/docs/installation/using-vite)
- **Quality:** [ESLint](https://eslint.org/) (with `eslint-plugin-react`, `react-hooks`, `react-refresh`), [Stylelint](https://stylelint.io/) + `stylelint-config-standard`, [HTMLHint](https://htmlhint.com/), [Prettier](https://prettier.io/) + `prettier-plugin-tailwindcss`
- **Tests:** [Vitest](https://vitest.dev/) with UI + coverage modes, `jsdom` environment, [Testing Library](https://testing-library.com/) for React
- **Vite plugins:** [`vite-plugin-eslint2`](https://vite-plugin-eslint2.modyqyw.top/), [`vite-plugin-stylelint`](https://vite-plugin-stylelint.modyqyw.top/), [`rollup-plugin-visualizer`](https://github.com/btd/rollup-plugin-visualizer) (analyze)
- **Automation:** Husky + lint-staged pre-commit, GitHub Actions for CI, tag-driven releases, biweekly patch releases, auto-merge for Dependabot patch/minor and the biweekly in-range `npm update`
## Scripts
| Command | What it does |
| ----------------------- | --------------------------------------------------------- |
| `npm run dev` | Start Vite dev server |
| `npm run build` | Production build to `dist/` |
| `npm run preview` | Serve the production build locally |
| `npm run lint` | ESLint + Stylelint + HTMLHint |
| `npm run lint:fix` | Same, auto-fixing what's fixable |
| `npm run format` | Prettier write across `src/**` |
| `npm run format:check` | Prettier check (no writes) |
| `npm run test` | Vitest watch |
| `npm run test:ci` | Vitest single run |
| `npm run test:ui` | Vitest UI |
| `npm run test:coverage` | Vitest coverage report |
| `npm run analyze` | Build with bundle visualizer, opens `dist/stats.html` |
| `npm run audit` | `npm audit` across the full tree (dev included) |
| `npm run audit:prod` | `npm audit --omit=dev --audit-level=moderate` |
| `npm run audit:fix` | `npm audit fix` |
| `npm run release:check` | Same gates as CI: lint, format, test, build, `audit:prod` |
| `npm run clean` | Remove `dist/` and `coverage/` |
## Project layout
```
src/
components/ React components (App scaffolding, Error Boundary, lazy route)
test/ setup.js (testing-library jest-dom)
App.jsx root component
main.jsx entry, mounts <App />
style.css Tailwind directives
public/ copied as-is to dist/ (favicons, OG image, .htaccess, privacy and 404 pages, matomo.js)
.github/brand/ README, OG and social images (SVG sources, render script, fonts)
scripts/ release helpers and stack-versions.mjs (lockfile versions for the landing page)
index.html Vite entry, references src/main.jsx
vite.config.js build + test config + bundle analyzer toggle
```
## Configuration
| File | Purpose |
| ----------------------------------- | ------------------------------------- |
| `eslint.config.js` | ESLint flat config with React plugins |
| `.stylelintrc` + `.stylelintignore` | Stylelint |
| `.htmlhintrc` | HTMLHint |
| `prettier.config.mjs` | Prettier + Tailwind plugin |
| `vitest.config.js` | Vitest |
| `.editorconfig` + `.nvmrc` | Editor + Node version pinning |
| `.lintstagedrc.js` | lint-staged pre-commit config |
Production builds set `build.sourcemap: 'hidden'`: maps are produced for crash-reporting tooling but never referenced from the built JS. `vite build --mode development` (or `--mode analyze`) emits full referenced sourcemaps for local debugging. `dist/` and `coverage/` are build output, untracked, and not published.
## Deployment
The site at [vitereact.marcopontili.com](https://vitereact.marcopontili.com) is hosted on Netsons behind Cloudflare. `.github/workflows/deploy.yml` runs on every push to `main` (or a manual dispatch from `main`): it tests, builds, mirrors `dist/` to the FTP root over SFTP or FTPS, then purges the Cloudflare cache for the host. `public/.htaccess` sets the SPA fallback, security headers, CSP and caching. Analytics is a self-hosted, cookieless Matomo loaded from `public/matomo.js`; delete that file and its `<script>` tag in `index.html` when you use the starter.
## Releases
Changes land on `develop`, then a release commit (`chore(release): vX.Y.Z`) merges to `develop`, the merge is tagged `vX.Y.Z`, and `main` is merged up from `develop`. The `release.yml` workflow then runs `release:check` against the tag and publishes a GitHub Release whose body is built from `CHANGELOG.md` by `scripts/release-notes-from-changelog.mjs`.
A scheduled workflow (`scheduled-patch-release.yml`) runs the bump, PR, merge, tag, and `main` sync biweekly on the 3rd and 17th UTC. The sync merges rather than fast-forwards, so a commit that lands on `main` alone (Dependabot security PRs target the default branch) cannot wedge the pipeline. See [`CHANGELOG.md`](./CHANGELOG.md) for the full history.
Two days ahead of it, `scheduled-npm-update.yml` opens an in-range `npm update` PR on the 1st and 15th and auto-merges it once CI passes, so the release picks the bumps up unattended. Only major bumps still need a human.
### Audit gate
`release:check` blocks on production dependencies only (`npm run audit:prod`). CI additionally runs a non-blocking full-tree `npm audit` so dev-toolchain advisories stay visible without being able to freeze releases when upstream has not published a fix yet. Run `npm run audit:fix` to clear them.
## Requirements
- [Node.js](https://nodejs.org/en) v22.22.2+ (the 22 line is pinned in `.nvmrc`, run `nvm use`); Vite 8 sets that floor
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md). Bug reports and feature requests go through [issues](https://github.com/marcop135/vite-react-tailwind-lint/issues). Vulnerabilities go through [SECURITY.md](./SECURITY.md) instead, and participation is covered by the [Code of Conduct](./CODE_OF_CONDUCT.md).
## Author
[Marco Pontili](https://marcopontili.com)
## License
[MIT](./LICENSE)
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

cove
The Cove Stack: 🏝️ minimal TanStack Start template with Vite+, Better Auth, Drizzle ORM, shadcn/ui
Vite · SaaS

vite-react-boilerplate
A production ready, scalable starter template for Vite + React
Vite · 启动器

vital
Starter template for Vite with React (TypeScript). Supports Tailwind. Vitest and @react/testing-library config…
Vite · 启动器

react-vite-admin
This Starter utilizes React, Recoil, React Query, React Hooks, Typescript, Axios And Vite. 全新技术栈的后台管理系统
Vite · 后台

typescript-react_best_practices-vite_template
<⚡⚛️> Start your React project with Vite following code best practices (TypeScript, Linting, testing, CI/CD…)
Vite · 启动器

cloudflare-starter-kit
Template (boilerplate) repository for scaffolding Cloudflare Workers projects
Vite · 启动器
