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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶 Bug RemoveComments + CollapseWhitespace - Correctly handle // JS comments #188

Open
Rikj000 opened this issue Feb 13, 2024 · 0 comments

Comments

@Rikj000
Copy link

Rikj000 commented Feb 13, 2024

Detailed description

Currently the RemoveComments,
and thus also CollapseWhitespace middlewares don't correctly strip out // Comments from JavaScript <script> tags.

Context

The described issue leads to broken compressed pages due to JavaScript code being // Commented out.

This also leads to confusion with developers trying to implement this package,
some might abandon the package, thinking it is broken while it is not.

Work Around

Replace all your JavaScript // Comments with <!-- Comment -->s

Your environment

Software Version
PHP v8.1.27
Laravel v10.43.0
Laravel-Page-Speed dev-master b16c018
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

1 participant