Minify Html is a plugin for Grav CMS that minify HTML output for better loading performance.
Shrink your website to load it faster!!!
Installing the Minify Html plugin can be done in two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install minify-html
This will install the Minify Html plugin into your /user/plugins
directory within Grav. Its files can be found under /your/site/grav/user/plugins/minify-html
.
To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to minify-html
. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/minify-html
NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems to operate.
If you use the admin plugin, you can install directly through the admin plugin by browsing the Plugins
tab and clicking on the Add
button.
Before configuring this plugin, you should copy the user/plugins/minify-html/minify-html.yaml
to user/config/plugins/minify-html.yaml
and only edit that copy.
Here is the default configuration:
enabled: true
cache: false
mode: default
You just have to enable the plugin to minify the HTML content. You can see the result by looking at the source in the browser.
You can enable or disable cache for Minify Html Plugin:
- When enabled, you will need to manually clear the cache if you make any page modifications.
You can choose between 3 compression mode:
- Default: compress JS and CSS but doesn't do it aggressively to get the smallest size.
- Fastest: only compresses HTML and ignores the rest.
- Smallest: compress everything aggressively to get the smallest size.
NOTE: If you use the default or the smallest mode you should disable Grav asset pipeline minify for CSS and JS as it could break you page.