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]: <!--#--> comments are not removed #155

Open
samualtnorman opened this issue Jun 13, 2023 · 1 comment
Open

[Bug]: <!--#--> comments are not removed #155

samualtnorman opened this issue Jun 13, 2023 · 1 comment

Comments

@samualtnorman
Copy link

samualtnorman commented Jun 13, 2023

What happened?

removeComments: true removes all comments except those that start with #.

If this is intentional behaviour, it would be neat if we had a flag to override it.

Version

v7.2.0

What browsers are you seeing the problem on?

Firefox, Chrome, Safari

Link to reproduce

https://stackblitz.com/edit/stackblitz-starters-trumlr?file=index.js

Relevant log output

No response

Willing to submit a PR?

No

@DanielRuf
Copy link
Contributor

If this is intentional behaviour, it would be neat if we had a flag to override it.

Yes, see the ignoreCustomComments setting, that you can change.

https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference

ignoreCustomComments Array of regex'es that allow to ignore certain comments, when matched [ /^!/, /^\s*#/ ]

So in your case removing , /^\s*#/ should work.

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

2 participants