Skip to content
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

chore(v2): replace classnames with clsx #2895

Merged
merged 2 commits into from
Jun 7, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Jun 6, 2020

Motivation

  • Reducing bundle size
  • Increasing performance

About clsx:

A tiny (228B) utility for constructing className strings conditionally.
Also serves as a faster & smaller drop-in replacement for the classnames module.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Preview.

All chunks size (parsed) for website v2.

Before After
4.21 MB 4.1 MB

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. label Jun 6, 2020
@lex111 lex111 requested a review from yangshun June 6, 2020 07:26
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 6, 2020
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 4011037

https://deploy-preview-2895--docusaurus-2.netlify.app

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

The problem with this is that most users manually installed classnames will now be shipping 2 versions of classname manipulation libraries because they included it in website. A very good example is our own v2 website.

@lex111
Copy link
Contributor Author

lex111 commented Jun 7, 2020

Yes, that’s true, but we can mention about it in release notes. We will have many new users who will no longer use classnames.

@yangshun yangshun merged commit afe9ff9 into master Jun 7, 2020
@yangshun yangshun deleted the lex111/replace-classnames-with-clsx branch June 7, 2020 05:40
@yangshun yangshun added the pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. label Jun 7, 2020
@yangshun
Copy link
Contributor

yangshun commented Jun 7, 2020

This is also kinda a breaking change for those who rely on classnames but don't directly put it in their package.json.

@yangshun
Copy link
Contributor

yangshun commented Jun 7, 2020

@fanny please take note of the change here for the bootstrap theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants