Invalid minification of js files containing template string




Wordpress LScache Plugin: Invalid minification of js files containing template string

Last Updated on: Wed, 15 Apr 2026 00:00:02
I noticed that my code stopped working after being deployed to the production site. const galleries = document.querySelectorAll( .gallery ) galleries.forEach((gallery) => Glightbox( selector: `#$ gallery.id a`, ...options, ) ) It turned out that Litespeed removes the space from the template string on minification. So `#$ gallery.id a` becomes `#$ gallery.id a` The solution is to write the code like this: # + gallery.id + a . However, it would be nice if the template strings worked as they should. This topic was modified 2 years, 2 months ago by Rafal Calka. This topic was modified 2 years, 2 months ago by Rafal Calka. This topic was modified 2 years, 2 months ago by Rafal Calka. This topic was modified 2 years, 2 months ago by Rafal Calka. This topic was modified 2 years, 2 months ago by tobifjellner (Tor-Bjorn Fjellner). Thanks for the feedback. Will check once finished JS optm improvement dev.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference