• Resolved Rafa? Ca?ka

    (@rafaucau)


    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.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Invalid minification of js files containing template string’ is closed to new replies.