http.minify Plugin

This feature does not come with Caddy by default. To get it, select the http.minify plugin when you download Caddy.

Minify static assets on-the-fly. Supports CSS, HTML, JS, JSON, SVG and XML.

Full documentation

Examples

Simple syntax

minify

Minify all of the supported files of the website.

Complete Syntax

minify paths... { if a cond b if_op [and|or] disable [js|css|html|json|svg|xml] minifier option value }

  • paths are space separated file paths to minify. If nothing is specified, the whole website will be minified.
  • if specifies a condition. Multiple ifs are AND-ed together by default. a and b are any string and may use request placeholders. cond is the condition, with possible values explained in rewrite (which also has an if statement).
  • if_op specifies how the ifs are evaluated; the default is and.
  • disable is used to indicate which minifiers to disable. By default, they're all activated.
  • minifier sets value for option on that minifier. When the option is true or false, its omission is trated as true. To know the options read the full documentation.

Minify one path

minify /assets

Only minify the contents of /assets folder.

Minify everything except a folder

minify { if {path} not_match ^(\/api).* }

Minify the whole website except /api.

Related Links

Documentation

Access the full documentation for this plugin off-site:

Docs

Plugin Help

Get help from the maintainers of the http.minify plugin:

Support

Plugin Website

Visit http.minify’s website for more information:

Website

Plugin Author: Henrique Dias

Last Updated: 8 Jul 2017, 1:31 PM

This plugin is independent of the Caddy project and is not endorsed or maintained by Caddy developers. Use at your own risk. Do not file issues for this plugin on Caddy’s bug tracker.