Skip to content

CSS coverage & warnings on unknown classes #1040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 14, 2025
Merged

CSS coverage & warnings on unknown classes #1040

merged 10 commits into from
Feb 14, 2025

Conversation

tivac
Copy link
Owner

@tivac tivac commented Feb 14, 2025

Description

Adds dev.warn and dev.coverage as supported options for @modular-css/css-to-js package, and by extension @modular-css/rollup and @modular-css/vite.

Motivation and Context

dev.warn will cause unknown classes requested from JS to log a warning to the console, instead of the current errors that are thrown.

dev.coverage will cause a global named mcssCoverage to be created which will track accesses of all exported classes per file and allow you to identify unused styles.

How Has This Been Tested?

Added/updated tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have added a changeset for my change.

Copy link

changeset-bot bot commented Feb 14, 2025

🦋 Changeset detected

Latest commit: b800294

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@modular-css/css-to-js Minor
@modular-css/vite Minor
@modular-css/rollup Minor
@modular-css/webpack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for m-css ready!

Name Link
🔨 Latest commit b800294
🔍 Latest deploy log https://app.netlify.com/sites/m-css/deploys/67afaae405d2390008ea73d4
😎 Deploy Preview https://deploy-preview-1040--m-css.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tivac tivac changed the title CSS coverage & warnings on unused classes CSS coverage & warnings on unknown classes Feb 14, 2025
@tivac tivac merged commit 17b6ae2 into main Feb 14, 2025
9 checks passed
@tivac tivac deleted the css-coverage branch February 14, 2025 21:12
@github-actions github-actions bot mentioned this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant