Skip to content

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

@GideonMax

Description

@GideonMax

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;
}

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