Skip to content

rokf/janet-datastar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

janet-datastar

This is a Janet utility library for building web applications using the Datastar hypermedia framework. It primarily contains helper functions for the various attributes, actions, and event types that Datastar is offering. It is meant to be used together with Janet's spork library (htmlgen and http modules).

Important

This library is not yet stable. Even though it probably contains functions for the majority of the functionality that Datastar is offering they have not all been tested yet, at least not well enough. Expect changes. I'll start adding semantic version tags once things stabilise.

API

The library is split into multiple modules:

  • datastar contains middleware and other stuff that doesn't exactly fit into any of the submodules.
  • datastar/attributes contains helper functions for Datastar's HTML attributes, such as data-on.
  • datastar/actions contains helper functions for Datastar's actions, such as @get().
  • datastar/events contains helper functions for all the SSE response types (events) Datastar is supporting.

Installation

The library can be installed with jpm using jpm install https://github.com/rokf/janet-datastar or by adding the following line into your project's dependency tuple:

{ :url "https://github.com/rokf/janet-datastar" :tag "main" }

Example

Warning

The example is currently broken and being reworked. Please refer to tests for the time being.

An example can be found in the example folder. It requires the following dependencies:

Tests

See the contents of the test folder. The tests require judge. Make sure that it's installed on your machine before you run them with judge test.

License

MIT - see the LICENSE file at the root of the repository for details.

About

A Janet utility library for the Datastar hypermedia framework

Topics

Resources

License

Stars

Watchers

Forks