JPeer264 / node-rename-css-selectors

📝 Rename css classes and id's in files
MIT License
65 stars 9 forks source link

Not completely renamed if there's a line break between class names #70

Closed ghost closed 3 years ago

ghost commented 3 years ago

First thanks for the great software,

I tried using a code prettify before node-rename-css-selectors and the prettify created a line break between the names of the classes of an element:

consider this valid prettified html according to https://html5.validator.nu/

<!DOCTYPE html>
<html lang="en">
  <head><title>Animals</title>
  </head>
  <body class="raccoons">
    <main class="unicorns">
      <section id="some-header">
        <h1>Hello this is dog</h1>
        <div class="container text-center d-flex flex-column justify-content-center align-items-center
            align-content-center ct-fluid">
        </div>
      </section>
    </main>
  </body>
</html>

see the line break after the "align-items-center" class? that is renamed by rcs to

<div class="t rqo nyy nwg nxr align-items-center nxp oup">

so it missed some renaming. moving the prettify function after the renaming makes everything right but rcs is still not renaming correctly valid html so I thought of it as a bug.

ghost commented 3 years ago

this might be because the prettifier has some config about maximum chars per line. The user can probably avoid this by tweaking that.

JPeer264 commented 3 years ago

Hey @personaaleatoria thanks for your issue. Could you may try the latest version and check if the issue still exists?

$ npm install rename-css-selectors@next
# or alternatively
$ npm install rename-css-selectors@4.0.0-rc.2
ghost commented 3 years ago

@JPeer264 Yes I am using version 4.0.0-rc.2

JPeer264 commented 3 years ago

Thanks. This is a confirmed bug. I will work on this in this week

JPeer264 commented 3 years ago

If you are using rename-css-selectors@4.0.0-rc.2 then you can update rcs-core to v3.5.1 and your bug should be resolved.

ghost commented 3 years ago

ok thanks! 👍