Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/snewcomer/minify-html-ssr

For SSR WASM import written in Rust
https://github.com/snewcomer/minify-html-ssr

html5 rust-lang

Last synced: 1 day ago
JSON representation

For SSR WASM import written in Rust

Awesome Lists containing this project

README

        

# minify-html-ssr
For SSR WASM import.

## What it does

This library removes extraneous whitespaces between HTML tags. Single spaces are preserved where necessary.

## Directions

### Local
1. wasm-pack build --target=nodejs --out-dir path-to-node-project
2. import and add `const { minify_html } = require('../utils/minify-html/html_whitespace');` to your render pipeline.

```
res.send(minify_html(body));
```
### npm package
1. `npm install minify-html-ssr`
2. Minify the html body before sent down.

## Downsides
- This is a runtime library. It is meant to work fast for you. However, a build time solution that collapses whitespace might be better for your app.

- Do you brotli compress your HTML? If not, you might be able to drop ~30% of your characters versus gzip.