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

https://github.com/iodesystems/hl-leaflet

Htmx Compatible Hypermedia Leaflet Engine
https://github.com/iodesystems/hl-leaflet

Last synced: 12 months ago
JSON representation

Htmx Compatible Hypermedia Leaflet Engine

Awesome Lists containing this project

README

          

# hl-leaflet

A [Leaflet](http://leafletjs.com/) plugin for `htmx` and `hypermedia` inspired
by [hyperleaflet](https://github.com/cemrehancavdar/hyperleaflet).

## Usage

When including the script, the library will automatically search for
all root `.hl-map` elements and configure and render them on document load.

Maps generated by the library cannot survive a full `htmx` `hx-swap`,
so it is advisable to put your `data-hl-render` target outside, and ensure it is
tagged with `hx-preserve`.

```html

```

When triggering `hx-swap`, you should take care to not re-render the map.

```html





```

## Tested With

- [Leaflet](http://leafletjs.com/) 1.4.4
- [htmx](https://htmx.org/) 1.9.9

## Development

```shell
npm install
npm run dev # Watches for changes and rebuilds dist
npm run build # Builds final dist
npm run test # Runs tests
```

## Publishing

```shell
npm login
npm publish
```

## Advanced htmx usage

See the [tests](https://github.com/IodeSystems/hl-leaflet/blob/main/src/hl-leaflet.test.ts) for advanced `hx-on`
and `hx-swap` usage.