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

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

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)