-
-
Notifications
You must be signed in to change notification settings - Fork 274
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: new minify-js arg for templ generate #880
base: main
Are you sure you want to change the base?
Conversation
also, does anyone know how to fix the CI/build step? running into the following error: |
Honestly, i kinda forgot that i started working on that 😅
The attribute checks are build on the assumption that those attribute are defined using a constant/static attribute declaration (not using a spread or conditional declaration). Mostly because of the way those are implemented right now. there is no easy check if those attributes are present/set at generation. I'll leave it up to @a-h to decide if that's acceptable or not. Might look into making that a bit more bomb proof in the future. For now it seems to work quite well. Any script tag content type that is supported by the minifier (tdewolff/minify/v2 ) will be minified. including Json content. Css minification is only applied to |
completed version of @cornejongs draft pr here
handled
templ Component() { <script ...>...</script> }
andscript Component() { ... }
cases.i've tested this locally by comparing outputs when -minify-js=true vs -minify-js=false with
go run ./cmd/templ generate -include-version=false -f [file] -minify-js=[bool]
do you have any ideas / starting points on how to write tests for an argument to
templ generate
? i didn't see any other examples in the project