postcss-modules icon indicating copy to clipboard operation
postcss-modules copied to clipboard

[Feature] Add ability to transform a selection of class names

Open GideonMax opened this issue 3 years ago • 0 comments

Currently, all class names get transformed. My problem is that some libraries expect you to modify a component's children's css using their classes, which I can't do with css modules rn as they get transformed.

Solution: Add an option, which can be set either through the plugin's settings or per individual file (using a comment), which either: a. explicitly states which class names should be transformed b. declares that only the first class in every declaration shall be transformed

example for option a:

/*module-transform: class-a class-d*/
.class-a .class-b{
  color: red;
}
.class-c .class-d{
  color: blue;
}

will result in

.class-a-*** .class-b{
  color:red
}
.class-c .class-d-***{
  color:blue;
}

example for option b:

/*module-transform-first*/
.class-a .class-b{
  color: red;
}
.class-c .class-d{
  color: blue;
}

will result in

.class-a-*** .class-b{
  color: red;
}
.class-c-*** .class-d{
  color: blue;
}

GideonMax avatar Dec 19 '22 15:12 GideonMax