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

[docs] Fix ClassNameGenerator content #32800

Merged
merged 4 commits into from
May 24, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented May 17, 2022

closes mui/mui-x#4767

Preview: https://deploy-preview-32800--material-ui.netlify.app/material-ui/experimental-api/classname-generator/

Updated content to always create an initializer file instead of using ClassNameGenerator directly in index.js. This is because of how bundler works (eg. webpack). Webpack hoist all imports which are run before the index.js

// es2015+
import { unstable_ClassNameGenerator as ClassNameGenerator } from "@mui/material/className";

console.log("test");
ClassNameGenerator.configure((name) => name.replace("Mui", "Custom"));

import * as React from "react";
import ReactDOM from "react-dom/client";
import { StyledEngineProvider } from "@mui/material/styles";
import Demo from "./demo";

ReactDOM.createRoot(document.querySelector("#root")).render(
  <StyledEngineProvider injectFirst>
    <Demo />
  </StyledEngineProvider>
);

The console.log("test") runs after Demo, that's why it does not work in mui/mui-x#4767.

Sorry, something went wrong.

@siriwatknp siriwatknp added the docs Improvements or additions to the documentation label May 17, 2022
@mui-bot
Copy link

mui-bot commented May 17, 2022

No bundle size changes

Generated by 🚫 dangerJS against 3ca3c8f

@siriwatknp siriwatknp requested a review from mnajdova May 17, 2022 10:34
@siriwatknp siriwatknp requested a review from alexfauquette May 23, 2022 05:34
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification 👍

@siriwatknp siriwatknp merged commit f50ef35 into mui:master May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Integration with classname Generator
3 participants