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:
- Finds all
.templfiles in theinternal/directory - Generates
@sourcedirectives with relative paths from the CSS file location - Adds your custom theme and utility classes
When does it run?
The script runs automatically as part of:
make build- Before building the CSSmake dev- Before starting watch mode
Manual usage
If you need to regenerate the sources manually:
./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.