google / postcss-rename

Replace class names based on a customizable renaming scheme.
Apache License 2.0
125 stars 18 forks source link

Apply skiplist to cssname parts #35

Closed eschoeffler closed 3 years ago

eschoeffler commented 3 years ago

When renaming by part, skip renaming parts that are in the except list of cssnames. This aligns renaming behavior with the was Google's module set server does renaming.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

eschoeffler commented 3 years ago

@googlebot I signed it!

rzhw commented 3 years ago

Looking at Closure Compiler, it seems like skipped names are applied prior to splitting, and not after.

Running Closure Stylesheets (the .jar here) seems to also replicate this, for example for a test.css containing:

.container, .full-height, .image.full-width {
  color: #000;
}

If we run Closure Stylesheets we get:

> java -jar ~/Downloads/closure-stylesheets.jar test.css --rename CLOSURE --excluded-classes-from-renaming full
.a,.b-c,.d.b-e{color:#000}
> java -jar ~/Downloads/closure-stylesheets.jar test.css --rename CLOSURE --excluded-classes-from-renaming full-height
.a,.full-height,.b.c-d{color:#000}

Can I confirm what behavior/config we're trying to align with?

eschoeffler commented 3 years ago

The goal is to align with the behavior used by Google's module set server. Google's module set server applies the skiplist to parts in addition to the whole. While this could be addressed in Google specific code, BY_PART renaming is primarily a Google use case, and so we should use Google's module set server renaming patterns as the canonical standard in this library.

rzhw commented 3 years ago

Thanks for clarifying!