Skip to content

Commit

Permalink
feat: Check if templ and tailwindcss commands are available before
Browse files Browse the repository at this point in the history
building (Melkeydev#295)
  • Loading branch information
jaswdr committed Aug 24, 2024
1 parent 74ee6d3 commit eaccd83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/template/framework/files/makefile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

# Build the application
all: build
{{if or ( .AdvancedOptions.htmx ) ( .AdvancedOptions.tailwind )}}

build:
check:
@command -v templ >/dev/null 2>&1 || { echo >&2 "templ is not installed. Run 'go install go install github.com/a-h/templ/cmd/templ@latest' to install it or check your environment."; exit 1; }
@command -v tailwindcss >/dev/null 2>&1 || { echo >&2 "tailwindcss is not install. Go to https://tailwindcss.com/docs/installation to install it or check your environment."; exit 1; }

{{end}}
build:{{if or ( .AdvancedOptions.htmx ) ( .AdvancedOptions.tailwind )}} check{{end}}
@echo "Building..."
{{if or ( .AdvancedOptions.htmx ) ( .AdvancedOptions.tailwind )}}@templ generate{{end}}
{{if .AdvancedOptions.tailwind}}@tailwindcss -i cmd/web/assets/css/input.css -o cmd/web/assets/css/output.css{{end}}
Expand Down

0 comments on commit eaccd83

Please sign in to comment.