Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/planety/kview

For karax html preview written in Nim.
https://github.com/planety/kview

jester karax nim prologue web

Last synced: 3 days ago
JSON representation

For karax html preview written in Nim.

Awesome Lists containing this project

README

        

![Test Prologue](https://github.com/planety/kview/workflows/Test%20Prologue/badge.svg)

# kview

### Installation

```text
nimble install kview
```

For karax html preview written in Nim.

```nim
# app.nim
import os, strutils

from kview import writeExample
import karax / [karaxdsl, vdom]

const
places = @["boston", "cleveland", "los angeles", "new orleans"]
first = "first"
second = "second"

# will write app_login.html
proc login*(name: string): string {.writeExample.} =
let vnode = buildHtml(tdiv(class = "mt-3")):
h1: text "My Web Page"
p: text "Hello " & name
ul:
for place in places:
li: text place
dl:
dt: text "Can I use Karax for client side single page apps?"
dd: text "Yes"

dt: text "Can I use Karax for server side HTML rendering?"
dd: text "Yes"
result = $vnode

discard login(first)
discard login(second)

assert readFile("app_login.html").strip() == """


My Web Page


Hello first



  • boston

  • cleveland

  • los angeles

  • new orleans



Can I use Karax for client side single page apps?

Yes

Can I use Karax for server side HTML rendering?

Yes



""".strip()
```

more examples in [tests](https://github.com/planety/kview/blob/master/tests/test.nim).