@sardine/eleventy-plugin-tinyhtml
v0.2.0
Published
A plugin for 11ty to minify and optimise HTML
Downloads
1,435
Readme
eleventy-plugin-tinyHTML
An 11ty plugin to optimise HTML.
Features
Uses html-minifier to optimise HTML.
You can pass html-minifier configuration object in the plugin's options
Requirements
Installation
npm install --save-dev @sardine/eleventy-plugin-tinyhtml
How to use it
const tinyHTML = require('@sardine/eleventy-plugin-tinyhtml');
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(tinyHTML);
};
Configuration
const tinyHTML = require('@sardine/eleventy-plugin-tinyhtml');
module.exports = function (eleventyConfig) {
const tinyHTMLOptions = {
html5: true,
removeRedundantAttributes : true,
};
eleventyConfig.addPlugin(tinyHTML, tinyHTMLOptions);
};
html-minifier options
By default the following options are used:
{
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
html5: true,
removeAttributeQuotes: true,
removeComments: true,
removeOptionalTags: true,
sortAttributes: true,
sortClassName: true,
};