compress html with grunt and htmlcompressor

npm install grunt-htmlcompressor
6 downloads in the last day
275 downloads in the last week
1 612 downloads in the last month

build status


Grunt plugin for html compression, using htmlcompressor.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-htmlcompressor

Then add this line to your project's grunt.js gruntfile:


Then specify what files to compress in your config:

  htmlcompressor: {
    compile: {
      files: {
        'dest/index.html': 'src/index.html'
      options: {
        type: 'html',
        preserveServerScript: true


htmlcompressor options

Options can be whatever htmlcompressor accepts

input/output files

src can be a string or a function processName can help you formating the output instead of using dest

Release History

  • 0.1.4 Async fixing
  • 0.1.0 Dynamic input (src parameter can be a function) and output (processName) files
  • 0.0.1 First Release


Copyright (c) 2012 Jean-S├ębastien Ney Licensed under the MIT license.

npm loves you