1

I'm using Jekyll to build a simple static website and Grunt to manage assets.

I'm trying to get grunt-contrib-htmlmin to minify my Jekyll templates. When I run jekyll build it takes my template files and places them in the _site directory. htmlmin then takes these html files and minifies them.

But once I run jekyll serve, the html files are overwritten with the unminified ones.

Is there a solution, or a better way of going about minifying them? I saw that Yeoman manages to minify html without any issues on Jekyll, but I can't figure out exactly how they do it.

My htmlmin settings in Gulpfile:

htmlmin: {
    dist: {
        options: {
            removeComments: true,
            collapseWhitespace: true,
            collapseBooleanAttributes: true,
            removeAttributeQuotes: true,
            removeRedundantAttributes: true,
            removeEmptyAttributes: true,
            minifyJS: true,
            minifyCSS: true
        },
        files: {
            '_site/index.html': '_site/index.html',
            '_site/it/index.html': '_site/it/index.html',
            '_site/fr/index.html': '_site/fr/index.html'  
        }
    }
},
RobC
  • 22,977
  • 20
  • 73
  • 80
DDiran
  • 533
  • 1
  • 6
  • 23

0 Answers0