Skip to content

Simplify exports #1243

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Simplify exports #1243

wants to merge 8 commits into from

Conversation

lukasoppermann
Copy link
Contributor

@lukasoppermann lukasoppermann commented Aug 4, 2025

Summary

Add simplified exports (→ imports) for css.

E.g.

@import '@primer/primitives/dist/css/functional/themes/light.css';
// can now be replaces by
@import '@primer/primitives/themes/light.css';

Testing:

@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 08:27
@lukasoppermann lukasoppermann requested review from a team as code owners August 4, 2025 08:27
@lukasoppermann lukasoppermann requested a review from jonrohan August 4, 2025 08:27
Copy link

changeset-bot bot commented Aug 4, 2025

🦋 Changeset detected

Latest commit: 1c7b569

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

This PR includes changesets to release 1 package
Name Type
@primer/primitives Patch

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

Copilot

This comment was marked as outdated.

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just left a comment! The only other thing that came to mind is that since "exports" is net new it might interfere with projects that are still including that dist path (since "exports" makes it strict what the package exports). Would it be worth adding support in for dist in the interim or are you doing this behind a major / making the changes downstream? Or is this not a problem, potentially?

@lukasoppermann
Copy link
Contributor Author

Just left a comment! The only other thing that came to mind is that since "exports" is net new it might interfere with projects that are still including that dist path (since "exports" makes it strict what the package exports). Would it be worth adding support in for dist in the interim or are you doing this behind a major / making the changes downstream? Or is this not a problem, potentially?

I came to the same conclusion and added dist and src to the exports

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds simplified export mappings to the package.json to enable shorter import paths for CSS files, eliminating the need to specify the full dist/css/functional/ path structure.

  • Adds exports field to package.json with path mappings for CSS files
  • Updates documentation to demonstrate the new shorter import syntax
  • Includes changeset for patch version bump

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Adds exports configuration with simplified path mappings for CSS imports
README.md Updates documentation to show new shorter import paths instead of full dist paths
.changeset/orange-hounds-unite.md Adds changeset entry for the simplified exports feature

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let me know if I can help try it out at all in PRC 👀

@lukasoppermann
Copy link
Contributor Author

LGTM! Let me know if I can help try it out at all in PRC 👀

Yes, please @joshblackprimer/react#6469
No idea why it fails, I can get this file locally in my test.

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.

2 participants