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

Streaming operation? #4

Closed kornelski closed 3 years ago

kornelski commented 4 years ago

I would like to process HTML with minimal buffering. .digest() is clever enough to operate on fragments, but accumulates the result instead of returning it.

Could you make it use io::Write instead of an internal buffer?

magiclen commented 4 years ago

Good idea. Let me see how to get rid of the private remove method first.

magiclen commented 4 years ago

The HTMLMinifierHelper struct with a low-level API has been added since 2.1.0. The digest method of a HTMLMinifierHelper instance can pass an instance which implements the io::Write trait as an output destination.

And after 3.0.0, this crate doesn't try to make HTML inline anymore in order to support [u8] input.