kilt
Version, currently 0.1.113 versions
- 0.6.1latestMar 24, 2021
- 0.6.0not indexedJun 1, 2022
- 0.5.0not indexedJun 1, 2022
- 0.4.1not indexedJun 1, 2022
- 0.4.0not indexedJun 1, 2022
- 0.3.3not indexedJun 1, 2022
- 0.3.2not indexedJun 1, 2022
- 0.3.1not indexedJun 1, 2022
- 0.3.0not indexedJun 1, 2022
- 0.2.1not indexedJun 1, 2022
- 0.2.0not indexedJun 1, 2022
- 0.1.1not indexedJun 1, 2022
- 0.1.0not indexedJun 1, 2022
github.com/jeromegn/kilt
Generic template interface for Crystal
152 stars
9 dependents
License: MIT
Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
kilt:
github: jeromegn/kilt
version: ~> 0.1.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# Kilt [](https://travis-ci.org/jeromegn/kilt)
Generic templating interface for Crystal.
## Goal
Simplify developers' lives by abstracting template rendering for multiple template languages.
## Supported out of the box
| Language | File extensions | Required libraries | Maintainer |
| -------- | --------------- | ------------------ | ---------- |
| ECR | .ecr | none (part of the stdlib) | |
| Mustache | .mustache | [crustache](https://github.com/MakeNowJust/crustache) | [@MakeNowJust](https://github.com/MakeNowJust) |
| Slang | .slang | [slang](https://github.com/jeromegn/slang) | [@jeromegn](https://github.com/jeromegn) |
| Temel | .temel | [temel](https://github.com/f/temel) | [@f](https://github.com/f) |
| Crikey | .crikey | [crikey](https://github.com/domgetter/crikey) | [@domgetter](https://github.com/domgetter) |
| Liquid | .liquid | [liquid](https://github.com/TechMagister/liquid.cr) | [@docelic](https://github.com/docelic) |
| Jbuilder | .jbuilder | [jbuilder](https://github.com/shootingfly/jbuilder) | [@shootingfly](https://github.com/shootingfly) |
| Water | .water | [water](https://github.com/shootingfly/water) | [@shootingfly](https://github.com/shootingfly) |
See also:
[Registering your own template engine](#registering-your-own-template-engine).
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
kilt:
github: jeromegn/kilt
# Any other template languages Crystal shard
```
## Usage
- Kilt essentially adds two macros `Kilt.embed` and `Kilt.file`, the code is really simple.
- Add template language dependencies, as listed in the support table above.
Both macros take a `filename` and a `io_name` (the latter defaults to `"__kilt_io__"`)
### Example
```crystal
require "kilt"
# For slang, add:
require "kilt/slang"
# With a Class
class YourView
Kilt.file("path/to/template.ecr") # Adds a to_s method
end
puts YourView.new.to_s # => <compiled template>
# Embedded
str = Kilt.render "path/to/template.slang"
# or
str = String.build do |__kilt_io__|
Kilt.embed "path/to/template.slang"
end
puts str # => <compiled template>
```
## Registering your own template engine
Use `Kilt.register_engine(extension, embed_command)` macro:
```crystal
require "kilt"
module MyEngine
macro embed(filename, io_name)
# ....
end
end
Kilt.register_engine("myeng", MyEngine.embed)
```
This can be part of your own `my-engine` library: in this case it should depend
on `kilt` directly, or this could be a part of adapter library, like:
`kilt-my-engine`, which will depend on both `kilt` and `my-engine`.
## Contributing
Please contribute your own "adapter" if you create a template language for Crystal that's not yet supported here!
1. Fork it ( https://github.com/jeromegn/kilt/fork )
2. Create your feature branch (git checkout -b my-awesome-template-language)
3. Commit your changes (git commit -am 'Add my-awesome-template-language')
4. Push to the branch (git push origin my-awesome-template-language)
5. Create a new Pull Request
## Contributors
- [jeromegn](https://github.com/jeromegn) Jerome Gravel-Niquet - creator, maintainer
- [waterlink](https://github.com/waterlink) Oleksii Fedorov
- [MakeNowJust](https://github.com/MakeNowJust) TSUYUSATO Kitsune
- [f](https://github.com/f) Fatih Kadir Akın
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- Jun 1, 2022
- Commit
394fea01da7b- Indexed
- not yet
Dependents
Repository
github.com/jeromegn/kilt
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 13