# nextjs-template **Repository Path**: woShenADong/nextjs-template ## Basic Information - **Project Name**: nextjs-template - **Description**: nextjs + tailwindcss模板 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-05-22 - **Last Updated**: 2026-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 官网 [nextjs项目模板](https://github.com/ixartz/Next-JS-Landing-Page-Starter-Template?tab=readme-ov-file) # 开发 ```sh pnpm install # 安装依赖 pnpm dev # 启动项目 pnpm build # 项目打包 ``` 使用您常用的浏览器打开 http://localhost:3000 查看您的项目。请注意,Next JS 首次编译项目需要一些时间。 ### 多主题 1.src/theme 添加对应主题css文件的相关变量 2.src/theme/tailwind-theme-var-define.ts 添加css变量到tailwindcss ```jsx
``` ### 国际化 1.src/locales 添加国际化文本内容 2.约定式路由文件(pages/[locale]目录)使用 getStaticPaths、getStaticProps 导出 ```jsx import { useTranslation } from 'next-i18next' import { getStaticPaths, makeStaticProps } from '@/lib/getStatic' const getStaticProps = makeStaticProps(['common', 'footer']) export { getStaticPaths, getStaticProps } const Index = ()=>{ const { t } = useTranslation(['common', 'footer']) return
{t('home.title')} {t('footer:change-locale')}
} ``` # docker部署 ```sh docker build -t container-name . # 打包docker镜像 docker run -p 3000:80 container-name # 启动容器,浏览器访问3000端口 ``` # 目录 ``` ├── README.md # README file ├── next.config.js # Next JS configuration ├── public # Public folder │ └── static │ └── images # Image used by default template ├── src │ ├── background # Atomic background component │ ├── button # Atomic button component │ ├── cta # Atomic cta component │ ├── feature # Atomic feature component │ ├── footer # Atomic footer component │ ├── hero # Atomic hero component │ ├── layout # Atomic layout component │ ├── navigation # Atomic navigation component │ ├── pages # Next JS pages │ ├── styles # PostCSS style folder with Tailwind │ ├── templates # Default template │ └── utils # Utility folder ├── tailwind.config.js # Tailwind CSS configuration └── tsconfig.json # TypeScript configuration ``` ## 特征 开发者体验优先: - 🔥 [Next.js](https://nextjs.org) 用于静态站点生成器 - 🎨 与 [Tailwind CSS](https://tailwindcss.com) 集成 - 💅 PostCSS 用于处理 Tailwind CSS 并集成到 `styled-jsx` - 🎉 类型检查 [TypeScript](https://www.typescriptlang.org) - ✅ TypeScript 和 React 18 的严格模式 - ✏️ 使用 [ESLint](https://eslint.org) 进行 Linter (默认 NextJS、NextJS Core Web Vitals 和 Airbnb 配置) - 🛠 代码格式化程序 [Prettier](https://prettier.io) - 🦊 Husky 的 Git Hooks - 🚫 Lint-staged 用于在 Git 暂存文件上运行 linters - 🗂 VSCode 配置:调试、设置、任务和 PostCSS、ESLint、Prettier、TypeScript 的扩展 - 🤖 Next SEO 的 SEO 元数据、JSON-LD 和 Open Graph 标签 - ⚙️ [Bundler 分析器](https://www.npmjs.com/package/@next/bundle-analyzer) - 🖱️ 使用 Netlify 一键部署(或手动部署到任何托管服务) - 🌈 [shadcn/ui](https://www.shadcn.com.cn/docs)组件库 - 💯 最大化灯塔得分 Next.js 的内置功能: - ☕ 压缩 HTML 和 CSS - 💨 实时重新加载 - ✅ 缓存清除 ## 定制 您可以轻松配置主题。请更改以下文件: - `public/apple-touch-icon.png`, `public/favicon.ico`, `public/favicon-16x16.png` and `public/favicon-32x32.png`: 你可以从 https://favicon.io/favicon-converter/ 生成 - `src/styles/global.css`: 使用 Tailwind CSS 的 CSS 文件 - `utils/AppConfig.ts`: 配置文件 - `src/pages/index.tsx`: 使用该组件的主题的首页 - `src/template/Base.tsx`: 使用组件块的组件 `Base` - `src/templates/*`: 组件块列表 - `src/*`: src 中的其他文件夹是组件块使用的原子组件 这是图层: - 入口点: `index.tsx` in `src/pages` - 模板 `Base` : `Base.tsx` in `src/templates` - use component blocks from `src/templates/*` - use atomic components from `src/*`