Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error Minimizing JSON File #175

Open
cemalgnlts opened this issue Dec 17, 2023 · 2 comments
Open

[Bug]: Error Minimizing JSON File #175

cemalgnlts opened this issue Dec 17, 2023 · 2 comments

Comments

@cemalgnlts
Copy link

What happened?

I tried to minimize this JSON file:

{
  "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
}

The error I received:
Error: Parse Error: <![$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![$[:alnum:]])(?:(?=\.\.\.)|(?!\.))" }

You can go to https://terser.org/html-minifier-terser/ and paste the JSON content and examine it.

Version

latest

What browsers are you seeing the problem on?

Chrome

Link to reproduce

No response

Relevant log output

No response

Willing to submit a PR?

None

@TaiYouWeb
Copy link

TaiYouWeb commented Jan 12, 2024

About

actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code

@DanielRuf
Copy link
Contributor

It's called html-minifier for a reason.

Try wrapping it in <script> like you can see in the screenshot:

image

To only minimize pure json, there are other tools that you can use. For example jq. https://remarkablemark.org/blog/2021/09/30/jq-minify-json/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants