parcel-bundler / parcel-bundler/lightningcss
[feat] Support CSS modules @value rule (or another way to import class names from other files)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
I'm currently using the CSS modules @value rule to import class names from other files. This allows using an external class name in a local selector. For example:
button.modules.css:
.button {
/* My button style. */
...
}
spinner.modules.css:
@value button from "./button.module.css";
.spinner {
/* My default spinner style. */
...
}
.button .spinner {
/* My spinner style when it's inside a button. */
...
}
It would be great if the @value rule was supported to enable this use case. Alternatively, adding support for the :import sytnax would also allow for importing external class names, but its syntax is not as convenient to use.
There may also be other ways to import external class names that I am unaware of, and perhaps one that is already supported by Lightning CSS. If so, please let me know.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating Lightning CSS's CSS Modules handling and checking whether @value or :import is already recognized. Use the button.modules.css and spinner.modules.css examples as a focused reproduction, then add support and coverage showing that an imported class name can be used in a local selector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, rust
- Domain
- compilers, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100