https://github.com/janmalch/ktor-revfile
Ktor server plugin for automatically revisioning static files.
https://github.com/janmalch/ktor-revfile
kotlin ktor ktor-plugin ktor-server
Last synced: about 1 year ago
JSON representation
Ktor server plugin for automatically revisioning static files.
- Host: GitHub
- URL: https://github.com/janmalch/ktor-revfile
- Owner: JanMalch
- License: apache-2.0
- Created: 2024-06-26T20:01:08.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T21:37:10.000Z (over 1 year ago)
- Last Synced: 2025-02-07T22:30:46.888Z (over 1 year ago)
- Topics: kotlin, ktor, ktor-plugin, ktor-server
- Language: Kotlin
- Homepage: https://janmalch.github.io/ktor-revfile/
- Size: 159 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Ktor RevFile
[](https://central.sonatype.com/artifact/io.github.janmalch/ktor-revfile-core)
A [Ktor server plugin](https://ktor.io/docs/server-plugins.html) made for automatically revisioning static files.
A revisioned file will include a short hash of its content in the file name.
This enables optimal caching without you ever having to change the name of the local file.
## Installation
This library is available on Maven Central.
```kotlin
implementation("io.github.janmalch:ktor-revfile-core:0.2.0")
implementation("io.github.janmalch:ktor-revfile-html:0.2.0") // add for kotlinx.html interop
```
## Usage
```kotlin
package com.example
object AppAssets : RevFileRegistry("/assets/") {
val main = resource("main.js")
val styles = resource("styles.css")
}
fun Application.module() {
install(RevFilePlugin) {
+AppAssets
}
}
```
Checkout the [complete documentation](https://janmalch.github.io/ktor-revfile) for usage details.