33 lines
1.0 KiB
Markdown
33 lines
1.0 KiB
Markdown
# Scripts
|
|
|
|
## generate-css-sources.sh
|
|
|
|
Automatically generates the `pkg/embedfs/files/css/input.css` file with `@source` directives for all `.templ` files in the project.
|
|
|
|
### Why is this needed?
|
|
|
|
Tailwind CSS v4 requires explicit `@source` directives to know which files to scan for utility classes. Glob patterns like `**/*.templ` don't work in `@source` directives, so each file must be listed individually.
|
|
|
|
This script:
|
|
1. Finds all `.templ` files in the `internal/` directory
|
|
2. Generates `@source` directives with relative paths from the CSS file location
|
|
3. Adds your custom theme and utility classes
|
|
|
|
### When does it run?
|
|
|
|
The script runs automatically as part of:
|
|
- `make build` - Before building the CSS
|
|
- `make dev` - Before starting watch mode
|
|
|
|
### Manual usage
|
|
|
|
If you need to regenerate the sources manually:
|
|
|
|
```bash
|
|
./scripts/generate-css-sources.sh
|
|
```
|
|
|
|
### Adding new template files
|
|
|
|
When you add a new `.templ` file, you don't need to do anything special - just run `make build` or `make dev` and the script will automatically pick up the new file.
|