Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexwkleung/simple-html-minifier-terser
A utility to minify HTML using html-minifier-terser with predefined options
https://github.com/alexwkleung/simple-html-minifier-terser
html-minifier html-minifier-terser utilities utility wrapper-functions
Last synced: about 1 month ago
JSON representation
A utility to minify HTML using html-minifier-terser with predefined options
- Host: GitHub
- URL: https://github.com/alexwkleung/simple-html-minifier-terser
- Owner: alexwkleung
- License: mit
- Created: 2023-05-07T00:45:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-07T18:32:23.000Z (over 1 year ago)
- Last Synced: 2024-11-07T14:31:22.954Z (3 months ago)
- Topics: html-minifier, html-minifier-terser, utilities, utility, wrapper-functions
- Language: TypeScript
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-html-minifier-terser
A utility to minify HTML using [html-minifier-terser](https://github.com/terser/html-minifier-terser) with predefined options.
Minifying HTML using html-minifier-terser requires setup by default. While some may prefer to manually setup html-minifier-terser, some just want a simple zero-config HTML minifier that just works. Therefore, those who are in the latter, including myself, will prefer using simple-html-minifier-terser for their needs.
This is ESM-only.
# Installation
Install via npm, directly from the repository.
```bash
npm install https://github.com/alexwkleung/simple-html-minifier-terser
```# Example Usage
`minifyHtml` function returns a promise, therefore you need to resolve it.
Here is a basic example:
```typescript
async function f(): Promise {
let template: string = `
foo
foo
`;return Promise.resolve(minifyHtml(template)).then((minifiedCallbackData) => {
console.log(minifiedCallbackData);
});
}
```# License
[MIT License.](https://github.com/alexwkleung/simple-html-minifier-terser/blob/main/LICENSE)