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

It incorrectly minifies JS tagged template strings #432

Open
GresiRoost opened this issue Oct 8, 2024 · 0 comments
Open

It incorrectly minifies JS tagged template strings #432

GresiRoost opened this issue Oct 8, 2024 · 0 comments

Comments

@GresiRoost
Copy link

In some occasions the minifier will incorrectly attempt to minify inside of tagged template strings:

Minimal example:

let test = html`
    <div>
       ${true ? html`
            <div>
                <span style="woo" ...${{foo:"bar"}}>${children}</span>
            </div>
        ` : null}
    </div>
`;

The incorrect output:

let test=html`
    <div>
       ${true ? html`<div><span style="woo"...${{foo:"bar"}}>${children}</span></div>` : null}
    </div>
`

Tehcnically it should not touch tagged template strings at all (and it doesn't in the outer one), but once it gets to the inner one it begins to remove space around tags.

Preact keeps working with this as the whitespace is not important between tags, but the breaking error here is that it removes the space before the '...'. This breaks the code.

Note: This is not HTML, it is HTML data inside of a string that the minifier should not touch at all.

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