Adds support to minify HTML in DocPad.

HTML-Minifier Plugin for DocPad

Allows minification of HTML in DocPad, using HTML-Minifier.

Convention: .html.anything

docpad install htmlmin

Create an HTML file with the htmlmin option:

htmlmin: true
<h1>HTML-Minifier Demo</h1>
<p>This file will be minified.</p>
<!-- This HTML comment will be removed when minified. -->

The default configuration for this plugin is the equivalant of adding the following html-minifier options to your DocPad configuration file:

      removeComments: true
      removeCommentsFromCDATA: false
      removeCDATASectionsFromCDATA: false
      collapseWhitespace: true
      collapseBooleanAttributes: false
      removeAttributeQuotes: false
      removeRedundantAttributes: false
      useShortDoctype: false
      removeEmptyAttributes: false
      removeOptionalTags: false
      removeEmptyElements: false
      # Disabled on development environments. 
          enabled: false

It is possible to override the default configuration on a per-template basis:

title: 'HTML-Minifier Demo'
  removeComments: false
<h1>HTML-Minifier Demo</h1>
<p>This file will be minified.</p>
<!-- This HTML comment will not removed when minified. -->

Discover the change history by heading on over to the file.

Discover how you can contribute by heading on over to the file.

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Become a contributor!

Licensed under the incredibly permissive MIT license

Copyright © Rob Loach (