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

Css args #484

Merged
merged 2 commits into from
Feb 1, 2024
Merged

Css args #484

merged 2 commits into from
Feb 1, 2024

Conversation

joerdav
Copy link
Collaborator

@joerdav joerdav commented Feb 1, 2024

Fixes #88

@joerdav joerdav requested a review from a-h February 1, 2024 18:53
Copy link
Owner

@a-h a-h left a comment

Choose a reason for hiding this comment

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

Brilliant. Nice to see this long requested feature implemented.

I'm happy to see the new Go parser paying off too. 😀

@@ -28,7 +28,7 @@ var templateExpressionParser = parse.Func(func(pi *parse.Input) (r templateExpre
// templ (x []string) Test() {
// becomes:
// func (x []string) Test() templ.Component {
if r.Expression, err = parseGoFuncDecl(pi); err != nil {
if _, r.Expression, err = parseTemplFuncDecl(pi); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if there's some debug value in the name of the templ, it could be passed down the context.

For example, the context could identify slow rendering components, or could print out a series of names: Page > Body > content > heading.

Not important, or that you need to do anything with this PR. Its just that your change sparked ideas. 😀

@a-h a-h merged commit f24922f into a-h:main Feb 1, 2024
4 checks passed
@jonerer
Copy link
Contributor

jonerer commented Feb 2, 2024

Looks very nice! The example in the documentation showcases an integer parameter, does it also handle strings?

Like for example background url('{ myVar }'). If so, what kind of escaping is used?

@koddr
Copy link

koddr commented Feb 28, 2024

It looks exactly the way I need it to look! 👍

@a-h when are you planning to release this?

@joerdav joerdav deleted the css-args branch February 28, 2024 10:48
@a-h
Copy link
Owner

a-h commented Feb 28, 2024

Plan to release tomorrow.

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.

css: Support arguments in CSS components
4 participants