Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Check if templ and tailwindcss commands are available before #296

Closed
wants to merge 1 commit into from

Conversation

jaswdr
Copy link

@jaswdr jaswdr commented Aug 24, 2024

building (#295)

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Problem/Feature

When creating a new project for the first time, and having tailwindcss and templ options enable, the Makefile does not check if those commands are available. I'm adding a "check" step in the Makefile to do this, and redirect the user to installed them if they are not available.

Description of Changes:

  • Makefile: Added check step if tailwindcss and templ options are enabled

Checklist

@Ujstor
Copy link
Collaborator

Ujstor commented Aug 24, 2024

I saw the PR after I commented on the open issue ticket. I just didn't pick up on the fact that you mentioned it in the PR. First, we need to resolve the linter issue. I will leave my review shortly.

Copy link
Collaborator

@Ujstor Ujstor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pipeline is fixed, it should pass on next push.


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; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding an option to install tmpl, similar to what I proposed in your open issue ticket?

@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}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should restrict check to only Unix-based OS. Unfortunately, this will not work on Win
{{if .UnixBased }}"check"{{ else }}""{{ end }}

@@ -2,8 +2,14 @@

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If htmx flag is used, only the tmpl check is needed. If tailwind is used, it will automatically include the htmx flag in the project, so the tmpl and htmx check need to be templated together.

@jaswdr
Copy link
Author

jaswdr commented Aug 25, 2024

Thanks, I'll take a look and check how to do it in Windows

@Ujstor
Copy link
Collaborator

Ujstor commented Aug 25, 2024

Thanks, I'll take a look and check how to do it in Windows

It would be nice to have a Windows implementation….something like 30% of blueprint users are on Win

@Ujstor
Copy link
Collaborator

Ujstor commented Sep 16, 2024

here were other open issues related to the Makefile, and I resolved them all in one PR.

#306

@Ujstor Ujstor closed this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants