Skip to content

The "Minify HTML advanced" option remove the first slash in path of the images #215

@FrenchLab47

Description

@FrenchLab47

I activated the option "Minify HTML Advanced" in my template, to delete HTML comments.
But that deletes images from the page.
Looking closer, I noticed that this option deletes the first slash in the img tag

img src = "/images/folder/myimage.jpg"

BECOMES:
img src = "images/folder/myimage.jpg"

That changes the relative URL, and the images disappear. (Idem on Windows and Linux server)

I found the code of this this option in the following file "libraries\astroid\framework\library\astroid\Document.php"
I noticed that this problem was caused by the $ns1 variable at line 432. It is a too complex regex for me.

While waiting for a solution to be found, I solved my problem in an incorrect, but radical way.
I simply canceled the variable like this> $ns1 = '';

Now the minification may not be complete, but I have no more comments or excess spaces.
And the paths of my images are not destroyed.

I thought it could also come from the SEF of Joomla 4, but I found nothing on this subject.
If this is not the case, I think you will find a more elegant solution than mine to modify this regex.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions