diff options
author | Alan Pearce | 2025-03-19 12:20:24 +0100 |
---|---|---|
committer | Alan Pearce | 2025-03-19 12:20:24 +0100 |
commit | 3a9a1fd26540ddd0299771a729740cdd88239dde (patch) | |
tree | 6a65ad391fa2ff3d52132643502739e9645f56a7 /README.md | |
parent | 5eae1eef0f0a090ae569a23c0c52db356a109cfc (diff) | |
download | gomponents-3a9a1fd26540ddd0299771a729740cdd88239dde.tar.lz gomponents-3a9a1fd26540ddd0299771a729740cdd88239dde.tar.zst gomponents-3a9a1fd26540ddd0299771a729740cdd88239dde.zip |
Rename and document fork v1.2.0
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/README.md b/README.md index f272f3b..5516a7b 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ <img src="logo.png" alt="Logo" width="300" align="right"> -[](https://pkg.go.dev/maragu.dev/gomponents) -[](https://github.com/maragudk/gomponents/actions/workflows/ci.yml) -[](https://codecov.io/gh/maragudk/gomponents) -[](https://goreportcard.com/report/maragu.dev/gomponents) +[](https://pkg.go.dev/go.alanpearce.eu/gomponents) +[](https://github.com/alanpearce/gomponents/actions/workflows/ci.yml) +[](https://codecov.io/gh/alanpearce/gomponents) +[](https://goreportcard.com/report/go.alanpearce.eu/gomponents) Try HTML components in pure Go. @@ -14,12 +14,15 @@ They render to HTML 5, and make it easy for you to build reusable components. So you can focus on building your app instead of learning yet another templating language. ```shell -go get maragu.dev/gomponents +go get go.alanpearce.eu/gomponents ``` -Made with ✨sparkles✨ by [maragu](https://www.maragu.dev/). +Made with ✨sparkles✨ by [maragu](https://www.maragu.dev/), forked by [alanpearce](https://alanpearce.eu) to add helpers. -Does your company depend on this project? [Contact me at markus@maragu.dk](mailto:markus@maragu.dk?Subject=Supporting%20your%20project) to discuss options for a one-time or recurring invoice to ensure its continued thriving. +## Fork changes + +- `MapWithIndex` and `MapMap` for mapping over slices and maps respectively +- `If` and `Iff` take an extra argument to render a fallback component when the condition is false ## Features @@ -43,16 +46,16 @@ Check out [www.gomponents.com](https://www.gomponents.com) for an introduction. ## Usage ```shell -go get maragu.dev/gomponents +go get go.alanpearce.eu/gomponents ``` ```go package main import ( - . "maragu.dev/gomponents" - . "maragu.dev/gomponents/components" - . "maragu.dev/gomponents/html" + . "go.alanpearce.eu/gomponents" + . "go.alanpearce.eu/gomponents/components" + . "go.alanpearce.eu/gomponents/html" ) func Navbar(authenticated bool, currentPath string) Node { @@ -121,27 +124,6 @@ I accept code contributions, especially with new HTML elements and attributes. I always welcome issues discussing interesting aspects of gomponents, and obviously bug reports and the like. But otherwise, I consider gomponents pretty much feature complete. -New features to the core library are unlikely to be merged, since I like keeping it simple and the API small. -In particular, new functions around collections (similar to `Map`) or flow control (`IfElse`/`Else`) will not be added. -`Map` was introduced before generics where a thing, and I think it's better to start using generic functions -from the stdlib or other libraries, instead of adding gomponents-specific variations of them to this library. - -If there's something missing that you need, I would recommend to keep small helper functions around in your own projects. -And if all else fails, you can always use an [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE): - -```go -func list(ordered bool) Node { - return func() Node { - // Do whatever you need to do, imperatively - if ordered { - return Ol() - } else { - return Ul() - } - }() -} -``` - ### What's up with the specially named elements and attributes? Unfortunately, there are some name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix, |