magiclen / html-minifier

This library can help you generate and minify your HTML code at the same time. It also supports to minify JS and CSS in `<style>`, `<script>` elements, and ignores the minification of `<pre>` elements.
MIT License
21 stars 5 forks source link

Command line tool #2

Open ioctl-user opened 5 years ago

ioctl-user commented 5 years ago

Hello!

Could you, please, add standalone utility to use html-minifier lib? To make possible things like this: cat big.html | html-min > little.html

I think it will be very useful, but I don't know rust and cargo to suggest patch. If you will do this, could you make utility with and without lib to minify js and css, please.

magiclen commented 5 years ago

Why do you want to do that if you are not using Rust to generate HTML code?

ioctl-user commented 5 years ago

Because I already have pages for my embedded web-server. I want to minify them on the project build.

magiclen commented 5 years ago

How about using Webpack and the html-webpack-plugin plugin? I think it would be a better way to make your pages maintainable.

ioctl-user commented 5 years ago

I know a lot of minifiers, but I would prefer tools that can be build from source on the project build, because I use buildroot (http://buildroot.org). Java Script utilities make potential problems for the project maintenance.

magiclen commented 4 years ago

This crate is more stable now and can be considered to build a standalone tool.

magiclen commented 4 years ago

@ioctl-user I would like to know why you didn't want to minify JS and CSS in minified HTML?

ioctl-user commented 4 years ago

It's quite contrary -- I'm looking for a standalone tool, that can be built from sources, to minify HTML. It would be wonderful, if this tool can minify JS and CSS inside HTML.

DrSensor commented 3 years ago

Just want to mention there is a similar project which also provide both cli and binding for other langs

https://github.com/wilsonzlin/minify-html

However, it statically linked to esbuild (optional) for JS & CSS minification which might be unsuitable to embed in another project