hupe1980 / gatsby-plugin-material-ui

Gatsby plugin for Material-UI with built-in server-side rendering support
MIT License
136 stars 25 forks source link

Material UI V5 support? #70

Closed ZLevine closed 3 years ago

ZLevine commented 3 years ago

Does this plugin work with Material UI V5 (alpha)? The docs only reference V3 and V4. Thanks!

oliviertassinari commented 3 years ago

@ZLevine This plugin is no longer needed in MUI v5. Instead, developers can leverage gatsby-plugin-emotion (not really needed) or gatsby-plugin-styled-components.

ZLevine commented 3 years ago

How so? I presume an MUI plugin would still be useful as it would abstract away a lot of things like server side stylesheets, ThemeProvider, etc.

oliviertassinari commented 3 years ago

abstract away a lot of things like server side stylesheets, ThemeProvider, etc.

@ZLevine Gatsby uses the notion of "theme" for the solution you are interested in. See https://github.com/hupe1980/gatsby-theme-material-ui.

ZLevine commented 3 years ago

Ah thanks, I didn't know there was a Gatsby theme for MUI!

oliviertassinari commented 3 years ago

Actually, I was wrong. We still need a plugin for Gatsby with Material-UI v5 based on https://github.com/mui-org/material-ui/issues/26561#issuecomment-855286153. Now, there is an extra layer of complexity, we support emotion and styled-components. So while we could argue, just use these plugins, we could also argue that these plugins do it wrong.

ZLevine commented 3 years ago

Gotcha. Yeah, it seems that because of all the complexity MUI requires for initial setup, a plugin would be preferable. Themes are great to "bootstrap" based on the plugin but a plugin seems more appropriate here.

oliviertassinari commented 3 years ago

We can start from https://github.com/mui-org/material-ui/tree/next/examples/gatsby/

hupe1980 commented 3 years ago

I have prepared the next branch accordingly

oliviertassinari commented 3 years ago

@hupe1980 Awesome, I have left a few comments on https://github.com/hupe1980/gatsby-plugin-material-ui/commit/c18fff2365be09cfa7f5437671a4d2adc0d414ae if you want to push it the extra mile.

My main concern with Gatsby is the trend it's on: https://npm-stat.com/charts.html?package=gatsby&package=next&package=react-scripts&from=2020-08-07&to=2021-08-07.

hupe1980 commented 3 years ago

The plugin can now also be used for V5:

npm install gatsby-plugin-material-ui@next @emotion/react

Only emotion is supported at the moment!

ZLevine commented 3 years ago

The plugin can now also be used for V5:

npm install gatsby-plugin-material-ui@next @emotion/react

Only emotion is supported at the moment!

This is fantastic news! Will test this out soon.

@hupe1980 Awesome, I have left a few comments on c18fff2 if you want to push it the extra mile.

My main concern with Gatsby is the trend it's on: https://npm-stat.com/charts.html?package=gatsby&package=next&package=react-scripts&from=2020-08-07&to=2021-08-07.

Yeah—from experience, Gatsby SSG can be a pain for larger sites and they don't have true SSR like Next does. For smaller sites, it's still a really great way to bootstrap things and get up and running quickly. I love the Gatsby plugin ecosystem but there's an open RFC in Next for the same thing. Next seems to be leaping over them in terms of features, performance, and developer experience. It's easier for Next to compete because they have a real company behind them that makes money from a myriad of products.

Anyways, I don't think Gatsby is going anywhere and it will continue to have a place. Just not necessarily for large sites. :)

ZLevine commented 3 years ago

Just tested and can confirm that MUI V5 functions correctly on the next branch! Thanks @hupe1980 and @oliviertassinari . Will log new issues if I run into anything else in development.