Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months ago
JSON representation
For SSR WASM import written in Rust
- Host: GitHub
- URL: https://github.com/snewcomer/minify-html-ssr
- Owner: snewcomer
- License: mit
- Created: 2021-04-05T03:54:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-14T04:05:36.000Z (over 3 years ago)
- Last Synced: 2024-10-03T12:23:32.697Z (3 months ago)
- Topics: html5, rust-lang
- Language: Rust
- Homepage:
- Size: 8.54 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.