damonbauer / npm-build-boilerplate

A collection of packages that build a website using npm scripts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTML Compress

kuanhsuh opened this issue · comments

how do you deal with compressing HTML with this boilerplate

commented

You can try a templating language to handle HTML files like Pug. See example: http://github.com/tpkahlon/npm-app.git.

It's possible to do it in the command line using HTML-minifier (https://github.com/kangax/html-minifier) and therefore also possible with a npm script.

Example below with likely options/settings when using HTML-minifier:

html-minifier --input-dir html/ --output-dir html/ --file-ext html --collapse-whitespace --remove-comments --minify-js --minfy-css

@kuansuh, the comment above from @adamgian looks like a good solution.