|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is an Angular 21 template application integrated with Tailwind CSS 4. It uses standalone components (no NgModules), Vitest for testing, and npm as the package manager. |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +**Start dev server:** |
| 12 | +```bash |
| 13 | +ng serve |
| 14 | +# or |
| 15 | +npm start |
| 16 | +``` |
| 17 | +Server runs at http://localhost:4200/ |
| 18 | + |
| 19 | +**Build:** |
| 20 | +```bash |
| 21 | +ng build # Production build (default) |
| 22 | +ng build --configuration development # Development build |
| 23 | +npm run watch # Watch mode with development config |
| 24 | +``` |
| 25 | +Build output: `dist/` directory |
| 26 | + |
| 27 | +**Testing:** |
| 28 | +```bash |
| 29 | +ng test # Run all tests with Vitest |
| 30 | +npm test # Same as above |
| 31 | +``` |
| 32 | + |
| 33 | +**Generate code:** |
| 34 | +```bash |
| 35 | +ng generate component component-name |
| 36 | +ng generate --help # See all available schematics |
| 37 | +``` |
| 38 | + |
| 39 | +## Architecture |
| 40 | + |
| 41 | +### Component Structure |
| 42 | + |
| 43 | +This application uses Angular's standalone component architecture (no NgModules). Components are organized by type: |
| 44 | + |
| 45 | +- **Layout components** (`src/app/components/`): Reusable UI elements like Header and Footer |
| 46 | +- **Page components** (`src/app/pages/`): Route-level components (Home, About, Services, Contact) |
| 47 | + |
| 48 | +### Routing |
| 49 | + |
| 50 | +Routes are defined in `src/app/app.routes.ts`. The application uses eager loading for all routes with a catch-all redirect to home for unknown paths. |
| 51 | + |
| 52 | +### Styling |
| 53 | + |
| 54 | +**Tailwind CSS v4 Setup:** |
| 55 | +- **Global styles:** `src/styles.css` uses `@import "tailwindcss";` (v4 syntax, not `@tailwind` directives) |
| 56 | +- **Tailwind config:** `tailwind.config.js` (scans `src/**/*.{html,ts}`) |
| 57 | +- **PostCSS config:** `.postcssrc.json` (uses `@tailwindcss/postcss` plugin required for v4) |
| 58 | +- **Component styles:** Each component has its own `.css` file |
| 59 | +- The app supports both light and dark color schemes via `prefers-color-scheme` |
| 60 | +- Layout uses CSS flexbox with `.page-container` and `.content-wrapper` classes for sticky footer |
| 61 | + |
| 62 | +**Important:** This project uses Tailwind CSS v4 which requires: |
| 63 | +1. The new `@import "tailwindcss";` syntax instead of old `@tailwind` directives |
| 64 | +2. The `@tailwindcss/postcss` package and `.postcssrc.json` configuration |
| 65 | + |
| 66 | +### Application Bootstrap |
| 67 | + |
| 68 | +- Entry point: `src/main.ts` |
| 69 | +- App config: `src/app/app.config.ts` (provides router and global error listeners) |
| 70 | +- Root component: `src/app/app.ts` (includes RouterOutlet, Header, and Footer) |
| 71 | + |
| 72 | +### File Naming Convention |
| 73 | + |
| 74 | +Components use a simple naming pattern without `.component` suffix: |
| 75 | +- TypeScript: `component-name.ts` |
| 76 | +- Template: `component-name.html` |
| 77 | +- Styles: `component-name.css` |
| 78 | +- Tests: `component-name.spec.ts` |
| 79 | + |
| 80 | +Example: `header.ts`, `header.html`, `header.css`, `header.spec.ts` |
| 81 | + |
| 82 | +### Component Patterns |
| 83 | + |
| 84 | +Components use: |
| 85 | +- `imports` array instead of module declarations |
| 86 | +- `templateUrl` and `styleUrl` for external files |
| 87 | +- Standard Angular imports like `RouterLink`, `RouterLinkActive`, `CommonModule` as needed |
| 88 | + |
| 89 | +## Build Configuration |
| 90 | + |
| 91 | +Bundle size budgets (production): |
| 92 | +- Initial bundle: 500kB warning, 1MB error |
| 93 | +- Component styles: 4kB warning, 8kB error |
| 94 | + |
| 95 | +## Prettier Configuration |
| 96 | + |
| 97 | +Configured in `package.json`: |
| 98 | +- Print width: 100 |
| 99 | +- Single quotes: enabled |
| 100 | +- Angular parser for HTML files |
0 commit comments