Skip to content

[code-infra] Ease playground creation #1322

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 1 commit into
base: master
Choose a base branch
from

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jan 10, 2025

I initially tried https://github.com/mui/material-ui/blob/HEAD/CONTRIBUTING.md#trying-changes-on-the-playground but it didn't work. It then took me some time to figure out how to get a working playground.

Maybe this can help?

Off-topic. Tailwind CSS doesn't load on the playground. I believe we should configure it.

@oliviertassinari oliviertassinari force-pushed the ease-playground-creation branch from 30ed724 to 75842a8 Compare January 10, 2025 23:51
@@ -10,6 +10,7 @@
"dev": "next dev --port 3005",
"deploy": "git push -f material-ui-docs master:latest",
"serve": "serve ./export -l 3010",
"create-playground": "cpy --cwd=scripts playground.template.tsx \"../../src/app/(private)/playground\" --rename=index.tsx",
Copy link
Member

Choose a reason for hiding this comment

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

I feel like it would be easier to just move playground.template.tsx to ../(private)/playground and manually duplicate/copy it when you want to make a new playground
In the Material UI repo I've used the playground script once (maybe twice?) and after that I just made new ones by duplicating something already tehre

Copy link
Member

Choose a reason for hiding this comment

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

👍 I agree, I never used the script. The main problem I currently see with the playgrounds is how deeply nested they are in the directory tree.

Copy link
Member

Choose a reason for hiding this comment

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

how deeply nested they are in the directory tree

Now that you mention this, what I've been doing a lot (manually in the terminal) is copying some demo in /(public) to the playground dir, and replacing the style import with import styles from '../../(public)/(content)/react/components/slider/demos/hero/css-modules/index.module.css'; (repeatedly from my clipboard history 😅)

Maybe you all are doing something similar as well? If so maybe a script could help, e.g. take the path to a demo and copy that demo to the playground, optionally rewrite the path to styles or copy the css file as well: pnpm create-playground slider/demos/hero (or menu/demos/checkbox-items etc)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I see how this could be useful. If it also opened the created playground in vscode, it would be nearly perfect :)

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 29, 2025
@michaldudak michaldudak added scope: infra Infrastructure work going on behind the scenes and removed scope: code-infra labels May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: out-of-date The pull request has merge conflicts and can't be merged scope: infra Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants