https://github.com/devetek/caddyserver-minifier
Caddyserver v2 plugin minifier
https://github.com/devetek/caddyserver-minifier
caddyserver minifier-html
Last synced: 6 months ago
JSON representation
Caddyserver v2 plugin minifier
- Host: GitHub
- URL: https://github.com/devetek/caddyserver-minifier
- Owner: devetek
- Created: 2024-01-16T14:59:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-24T16:08:15.000Z (over 1 year ago)
- Last Synced: 2024-06-21T18:44:30.793Z (11 months ago)
- Topics: caddyserver, minifier-html
- Language: Go
- Homepage: https://cloud.terpusat.com/
- Size: 37.1 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Caddyserver v2 Plugin - Minifier
Caddyserver v2 plugin that implements minification on-the-fly for CSS, HTML, JSON, SVG and XML. It uses [tdewolff's library](https://github.com/tdewolff/minify) so, let's thank him!.
## Syntax
Because this directive does not come standard with Caddy, you may use route to order it the way you want. For example:
Minimum configuration:
```sh
http://localhost:9200 {
route {
minifier
reverse_proxy localhost:8097
}
}
```Partial configuration:
```sh
http://localhost:9200 {
route {
minifier {
html {
KeepDefaultAttrVals true
KeepDocumentTags true
KeepEndTags true
KeepQuotes true
}
}
reverse_proxy localhost:8097
}
}
```Full configuration:
```sh
http://localhost:9200 {
route {
minifier {
html {
KeepConditionalComments true
KeepSpecialComments true
KeepComments true
KeepWhitespace true
KeepDefaultAttrVals true
KeepDocumentTags true
KeepEndTags true
KeepQuotes true
}
}
reverse_proxy localhost:8097
}
}
```## Todo
- [ ] Support for another `Content-Type` (css, js, etc):
```sh
minifier {
js
css
}
```## Credit
Special thanks to @mholt for making a good documentation on how to use unstandard Caddy plugins, [mholt/caddy-webdav](https://github.com/mholt/caddy-webdav)