Fix Node.js API example in README

This commit is contained in:
Wilson Lin 2020-07-24 19:57:11 +10:00
parent eb886014e8
commit 8733ca4b59
1 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ yarn add @minify-html/js
```js
const minifyHtml = require("@minify-html/js");
const cfg = { minifyJs: false };
const cfg = minifyHtml.createConfiguration({ minifyJs: false });
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
// Alternatively, minify in place to avoid copying.
@ -138,7 +138,7 @@ minify-html is also available for TypeScript:
import * as minifyHtml from "@minify-html/js";
import * as fs from "fs";
const cfg = { minifyJs: false };
const cfg = minifyHtml.createConfiguration({ minifyJs: false });
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
// Or alternatively:
const minified = minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);