a-h / templ

A language for writing HTML user interfaces in Go.
https://templ.guide/
MIT License
7.14k stars 236 forks source link

css expression: found unexpected parameters #789

Open leomorpho opened 3 weeks ago

leomorpho commented 3 weeks ago

Not sure what I'm missing, but when using a parameterized css function, it fails using templ v0.2.707.

css loading(percent int) {
    width: { fmt.Sprintf("%d%%", percent) };
}

The above gives me css expression: found unexpected parameters. I must be doing something wrong because this is an example from the docs, but I can't figure out what that is...any ideas?

chilljalapeno commented 1 week ago

You can try without the two percentage signs after d, I think it is a mistype. css loading(percent int) { width: {fmt.Sprintf("%d", percent) }; } It works for me, I have some similar code. Hope it helps

joerdav commented 1 week ago

@leomorpho I tried to recreate the error but could not. I pasted it into https://play.templ.guide/ and had no issue.

JoshuaSchlichting commented 4 days ago

@leomorpho I had this issue with v0.2.408. I installed the latest version via go install github.com/a-h/templ/cmd/templ@latest, bringing me up to v0.2.731, and the error appears to have cleared up!