all repos — gomponents @ a76262652b227c95ce140f3698c46f59b79354ac

HTML components in pure Go

Move elements and attributes into html package (#52) This makes it easier to use dot-imports. Also updated the readme and examples with new usage, and move the `Classes` helper into the `components` package.

Markus Wüstenberg
commit

a76262652b227c95ce140f3698c46f59b79354ac

parent

a7e24c6cddaafb98091c3989c9da7779eeba30b5

1 file changed, 3 insertions(+), 4 deletions(-)

changed files
M attr/attributes.gocomponents/attributes.go
@@ -1,6 +1,4 @@
-// Package attr provides shortcuts and helpers to common HTML attributes. -// See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes for a list of attributes. -package attr +package components import ( "io"
@@ -8,6 +6,7 @@ "sort"
"strings" g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/html" ) // Classes is a map of strings to booleans, which Renders to an attribute with name "class".
@@ -23,7 +22,7 @@ included = append(included, c)
} } sort.Strings(included) - return g.Attr("class", strings.Join(included, " ")).Render(w) + return html.Class(strings.Join(included, " ")).Render(w) } func (c Classes) Type() g.NodeType {