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

https://github.com/opensly/kanva

kanva.js is a lightweight JavaScript library for dynamically loading HTML partials, offering simple, attribute-based templating for static sites and modular web applications.
https://github.com/opensly/kanva

Last synced: about 1 year ago
JSON representation

kanva.js is a lightweight JavaScript library for dynamically loading HTML partials, offering simple, attribute-based templating for static sites and modular web applications.

Awesome Lists containing this project

README

          

# kanva.js

## Overview

kanva.js is a lightweight JavaScript library designed to simplify the process of loading and rendering HTML partials within your web applications. It provides an easy way to manage and include reusable components, improving maintainability and modularity.

## Features
- Dynamic loading of HTML partials based on URL or custom attributes.
- Easy integration with existing projects.
- Lightweight and fast, without dependencies.

## Installation

You can include `kanva.js` in your project by downloading the file or linking to it via a CDN.
```

```
Ensure that your HTML structure includes a element where the content will be dynamically loaded.

## Usage

Your HTML should contain a `` element, which can be configured to load different partials based on attributes. You can use `kanva.js` in two ways depending on your needs:

*By Name:* Load a specific partial by setting the name attribute on the .
```

```

This will load the `child1.tpl` partial.

*By Route:* Load a partial based on the current URL. Set the route attribute on the .

```

```

This will load the `child1.tpl` or `child2.tpl` partial based on the last segment of the URL.

### Example
```



kanva.js Example



```

## Contributing

I welcome contributions! To get involved, please fork the repository and submit a pull request. For significant changes, consider opening an issue first to discuss your ideas.

## License

This project is licensed under the MIT License. See the LICENSE file for details.