Skip to content

Allow preserving redundant / empty attribute values to prevent React hydration errors #279

Open

Description

@w-biggs

When using this library to minify HTML while using React server-side rendering, the removal of redundant & empty string attributes is causing hydration issues. React expects these attribute values to remain unchanged.

We're looking to migrate from html-minifier-terser, which has the configuration options removeRedundantAttributes and removeEmptyAttributes (which we had set to false), but there's no such configuration in this library. It would be really nice to have similar configuration capabilities in this library. This blocks us from migrating, which is a shame because it's something like 30x faster for us. None of the alternatives are nearly as fast.

(As an aside, we also see different behavior with extra spaces being trimmed in className attributes, but this is easier for us to avoid on the code side of things. Being able to toggle this behavior would also be nice, though.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions