From 6e2f2465a4e1d075486d0be89245b8742aef488e Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Sat, 4 Dec 2021 15:55:16 +1100 Subject: [PATCH] Simplify Node.js example --- README.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e31cb2f..0894ace 100644 --- a/README.md +++ b/README.md @@ -91,24 +91,18 @@ yarn add @minify-html/js ### Use -```js -const minifyHtml = require("@minify-html/js"); - -// Refer to TypeScript definitions for details. -const cfg = minifyHtml.createConfiguration({ keep_closing_tags: true, remove_bangs: false }); -const minified = minifyHtml.minify("

Hello, world!

", cfg); -``` - -minify-html is also available for TypeScript: +TypeScript definitions are available. ```ts import * as minifyHtml from "@minify-html/js"; -import * as fs from "fs"; +// Or `const minifyHtml = require("@minify-html/js")` if not using TS/ESM. const cfg = minifyHtml.createConfiguration({ keep_spaces_between_attributes: true, keep_comments: true }); const minified = minifyHtml.minify("

Hello, world!

", cfg); ``` +All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html) are available as snake_case properties on the object provided to `createConfiguration`; if any are not set, they default to `false`. +