Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hacdias/caddy-v1-minify

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hacdias/caddy-v1-minify

  • v1.0.2
  • Source
  • Go
  • Socket score

Version published
Created
Source

minify

CircleCI branch community Go Report Card

Caddy plugin that implements minification on-the-fly for CSS, HTML, JSON, SVG and XML. It uses tdewolff's library so, let's thank him! You can download this plugin with Caddy on its official download page.

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. The possible options are described bellow.

Minifiers options

Minifier(s)OptionValueDescription
css, svgdecimalsnumberPreserves default attribute values.
xml, htmlkeep_whitespacetrue|falsePreserves whitespace between inline tags but still collapse multiple whitespace characters into one.
htmlkeep_end_tagstrue|falsePreserves all end tags.
htmlkeep_document_tagstrue|falsePreserve html, head and body tags.
htmlkeep_default_attr_valstrue|falsePreserves default value attributes.
htmlkeep_conditional_commentstrue|falsePreserves all IE conditional comments.

For more information about what does each option and how each minifier work, read the documentation of tdewolff/minify.

Examples

Minify all of the supported files of the website:

minify

Only minify the contents of /assets folder:

minify /assets

Only minify css files:

minify {
    disable html svg json xml js
}

Minify the whole website except /api:

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

Minify the files of /assets folder except /assets/js:

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

Customize the minifier options:

minify {
    html keep_document_tags
    html keep_whitespace
}

FAQs

Package last updated on 15 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc