parcel-bundler / parcel-bundler/lightningcss

feat: CSS Modules `[hash]` to include class name

Open
#660 1 comment 6 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

Feature request

I'd like to request for the CSS Modules [hash] to include the class name. This would allow cssModules.pattern to be [hash] alone, without needing [local].

Why?

After CSS modularization, I use CSS Modules for these two major benefits:

  1. It condenses long, verbose class names into shorter, more manageable ones.

  2. It obfuscates class names, helping prevent reverse-engineering tactics, such as crawlers using selectors.

Furthermore, coming from a background of using CSS Modules with Webpack's css-loader, where [hash] generates a hash unique to each class name, I found a slight migration incompatibility with the current implementation in LightningCSS.

P.S. Great work on LightningCSS! It's packed with impressive features that I really appreciate.

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

No file or test path is named. Start by tracing CSS Modules pattern handling and hash generation in LightningCSS, then compare the current behavior with the linked css-loader semantics. Done means [hash] alone produces class-name-specific hashes without requiring [local], with the existing CSS Modules behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
build-system, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.