parcel-bundler / parcel-bundler/lightningcss

[feat] Support CSS modules @value rule (or another way to import class names from other files)

Open
#659 3 comments 10 reactions 0 assignees View on GitHub

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

Open the contributing guide

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.