Skip to content

Migrate batch 1 components from BEM to CSS Modules#2014

Open
paskal wants to merge 1 commit intomasterfrom
bem-to-css-modules-batch1
Open

Migrate batch 1 components from BEM to CSS Modules#2014
paskal wants to merge 1 commit intomasterfrom
bem-to-css-modules-batch1

Conversation

@paskal
Copy link
Collaborator

@paskal paskal commented Feb 24, 2026

Summary

  • Migrate 8 frontend components from BEM to CSS Modules: button, dropdown, thread, auth-panel, dropdown-item, list-comments, subscribe-by-rss, settings
  • Consolidate 19 BEM CSS files into 8 CSS Module files
  • Replace bem-react-helper b() calls with clsx for conditional class composition
  • Remove 12 index.ts barrel re-export files that are no longer needed
  • Update CLAUDE.md CSS guideline to reflect migration status

Visual regression verification

Built artefacts compared between master and this branch:

File Master Branch Delta
remark.css 43,779 B 43,299 B -480 B
last-comments.css 18,792 B 18,776 B -16 B
remark.js 256,709 B 304,837 B +48 KB (expected: classname maps in JS)
last-comments.js 121,726 B 168,615 B +47 KB (same reason)

Pixel-level screenshot comparison:

  • Dark theme: zero pixel difference
  • Light theme: zero remark42 widget difference (0.21% diff is the native demo page "Toggle theme" button, not any widget element)

Migrate 8 components from BEM to CSS Modules:
- button (7 BEM files -> 1 module)
- dropdown (7 BEM files -> 1 module)
- thread (3 BEM files -> 1 module)
- auth-panel (2 BEM files -> 1 module)
- dropdown-item, list-comments, subscribe-by-rss, settings (from batch 0 PR #2013)

Consolidates 19 BEM CSS files into 8 CSS Module files. Uses clsx for
conditional class composition, replacing bem-react-helper's b() calls.
Class naming follows the established convention: BEM block = .root,
elements = camelCase, modifiers = camelCase.

Visual regression verification on built artefacts:
- remark.css: 43,779 -> 43,299 bytes (480 bytes smaller)
- last-comments.css: 18,792 -> 18,776 bytes (16 bytes smaller)
- remark.js: 256,709 -> 304,837 bytes (48KB larger, expected: CSS Module
  classname mappings now live in JS instead of plain strings)
- Dark theme: pixel-identical (zero difference)
- Light theme: pixel-identical (0.21% diff is the native demo page
  "Toggle theme" button, not any remark42 widget element)

Also updates CLAUDE.md CSS guideline to reflect the migration status.
@paskal paskal requested a review from umputun as a code owner February 24, 2026 20:00
@github-actions
Copy link

size-limit report 📦

Path Size
public/embed.mjs 2.06 KB (0%)
public/remark.mjs 73.79 KB (-0.05% 🔽)
public/remark.css 8.17 KB (-0.67% 🔽)
public/last-comments.mjs 36.18 KB (-0.05% 🔽)
public/last-comments.css 3.74 KB (-0.19% 🔽)
public/deleteme.mjs 12.42 KB (0%)
public/counter.mjs 747 B (0%)

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.01%. Comparing base (b38d91c) to head (731f108).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2014      +/-   ##
==========================================
- Coverage   62.17%   62.01%   -0.16%     
==========================================
  Files         132      132              
  Lines        3035     3033       -2     
  Branches      769      735      -34     
==========================================
- Hits         1887     1881       -6     
- Misses       1144     1148       +4     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant