V4 add htmlmin

Minfies output for regular and debug builds, but it may make sense to move it to the "deploy" task only.
Other commits are to fix issues found during minification.