Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nakaixo/nakai
An HTML generation library for building web apps with Gleam ✨
https://github.com/nakaixo/nakai
gleam serverless
Last synced: about 1 month ago
JSON representation
An HTML generation library for building web apps with Gleam ✨
- Host: GitHub
- URL: https://github.com/nakaixo/nakai
- Owner: nakaixo
- License: mit
- Created: 2022-02-08T02:28:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-09T15:24:44.000Z (4 months ago)
- Last Synced: 2024-09-18T19:54:15.262Z (3 months ago)
- Topics: gleam, serverless
- Language: Gleam
- Homepage: https://nakaixo.github.io
- Size: 129 KB
- Stars: 112
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-gleam - nakai - [📚](https://hexdocs.pm/nakai/) - HTML generation for Gleam, on the server or anywhere else (Packages / HTML)
README
![Nakai](https://cdn.mckayla.cloud/-/2d8051c1ce2f4fbd91eaf07df5661e25/Nakai-Banner.svg)
[![Documentation](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/nakai/)
## Getting started
```sh
gleam add nakai
``````gleam
import nakai
import nakai/html.{type Node}
import nakai/attr.{type Attr}const header_style = "
color: #331f26;
font-family: 'Neuton', serif;
font-size: 128px;
font-weight: 400;
"pub fn header(attrs: List(Attr), text: String) -> Node {
let attrs = [attr.style(header_style), ..attrs]
html.h1_text(attrs, text)
}pub fn app() -> String {
html.div([],
[
html.Head([html.title("Hello!")]),
header([], "Hello, from Nakai!")
]
)
|> nakai.to_string()
}
```## Development
While Nakai itself is pure Gleam, and has no dependencies, the benchmarks require having [Elixir] installed, and building it requires that you have [Rebar3] installed.
[elixir]: https://elixir-lang.org/
[rebar3]: https://rebar3.org/