madyankin / madyankin/postcss-modules

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

Open
#147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
88
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the plugin's option handling and class-name transformation logic, then inspect how per-file comments are parsed. Done means supporting both the explicit class list and first-class-only behavior through the requested configuration paths, with coverage for the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
frontend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.