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

Author: elliotwaiteCreated Jan 15, 2024Updated Sep 4, 2026

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.

Source: parcel-bundler/lightningcss