From a7dbcb3f00d1a4a320473da9e950056af372836c Mon Sep 17 00:00:00 2001 From: hello <79901832+beep-beep-beep-boop@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:46:38 -0600 Subject: [PATCH] Document importing js-beautify through ESM imports --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index d7a583a4..956fcdce 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,17 @@ fs.readFile('foo.js', 'utf8', function (err, data) { }); ``` +If you are using ESM Imports, you can import `js-beautify` like this: + +```js +// 'beautify' can be any name here. +import beautify from 'js-beautify'; + +beautify.js(data, options); +beautify.html(data, options); +beautify.css(data, options); +``` + ## Python After installing, to beautify using Python: