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.
- Host: GitHub
- URL: https://github.com/opensly/kanva
- Owner: opensly
- License: mit
- Created: 2024-11-01T10:09:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-01T10:57:09.000Z (over 1 year ago)
- Last Synced: 2025-01-15T13:27:39.254Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.