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

Add conditional attribute, fixes #65 #66

Merged
merged 9 commits into from
Apr 8, 2023
Merged

Conversation

a-h
Copy link
Owner

@a-h a-h commented Apr 5, 2023

This PR adds the ability to add attributes to elements using if/else statements.

package testelementattributes

templ render(p person) {
	<div style="width: 100;"
		if p.important {
			class="important"
		}
	>Important</div>
	<div style="width: 100;"
		if !p.important {
			class="unimportant"
		}
	>Unimportant</div>
	<div style="width: 100;"
		if p.important {
			class="important"
		} else {
			class="unimportant"
		}
	>Else</div>
}

@a-h a-h merged commit fb6d392 into main Apr 8, 2023
@a-h a-h deleted the add_conditional_attribute branch April 8, 2023 10:00
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.

1 participant