2

Is there a way to render out minified html with Docpad? For reasons I'm too lazy to explain, grunt plugins are not a viable solution for me.

SirDemon
  • 1,758
  • 15
  • 24
  • You mean like Gzip your HTML files? I believe that's something your server can do on the fly before serving the content to the user. I imagine you mean that DocPad does it as part of the process though right? – greduan Jul 28 '13 at 20:59
  • No, not gzipping, just minifying, as in removing needless white-space, line ends and tabs, basically removing any unnecessary characters from the page. – SirDemon Jul 29 '13 at 05:40
  • 1
    Well. If you're using the CoffeeKup plugin it is possible to make it output not-nice output. So it's all in one line. Except the output from Markdown etc. Stuff that other plugins handle. – greduan Jul 30 '13 at 18:42

1 Answers1

1

It sure is possible. The CoffeeKup plugin will actually minify your HTML when generating on a production environment for you automatically, and I think the LessCSS plugin does this too.

Personally, I use CloudFlare to minify everything post-deployment: https://support.cloudflare.com/entries/22076718-How-do-I-minify-HTML-CSS-and-JavaScript-to-optimize-my-site-

However, you could also easily write a plugin to minify the content as well. You could base it off the Uglify plugin which minifies javascript files using uglify-js. The trick would be to just decide which node module you would like to do it with. Happy to help further on this path with additional questions and answers.

balupton
  • 47,113
  • 32
  • 131
  • 182