-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[material-ui] Remove UMD bundle (#42172)
Signed-off-by: Zeeshan Tamboli <[email protected]> Co-authored-by: Jan Potoms <[email protected]>
- Loading branch information
1 parent
cadb0b1
commit 393f744
Showing
13 changed files
with
51 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,20 +159,12 @@ For instance, via Google Web Fonts: | |
## CDN | ||
|
||
You can start using Material UI right away with minimal front-end infrastructure by installing it via CDN, which is a great option for rapid prototyping. | ||
Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/material-ui-via-cdn) to get started. | ||
|
||
<!-- #default-branch-switch --> | ||
|
||
Follow [this CDN example](https://github.com/mui/material-ui/tree/next/examples/material-ui-via-cdn) to get started. | ||
|
||
:::error | ||
We do _not_ recommend using this approach in production. | ||
It requires the client to download the entire library—regardless of which components are actually used—which negatively impacts performance and bandwidth utilization. | ||
::: | ||
|
||
Two Universal Module Definition (UMD) files are provided: | ||
|
||
- one for development: https://unpkg.com/@mui/material@latest/umd/material-ui.development.js | ||
- one for production: https://unpkg.com/@mui/material@latest/umd/material-ui.production.min.js | ||
|
||
:::warning | ||
The UMD links use the `latest` tag to point to the latest version of the library. | ||
This pointer is _unstable_ and subject to change as we release new versions. | ||
You should consider pointing to a specific version, such as [v5.0.0](https://unpkg.com/@mui/[email protected]/umd/material-ui.development.js). | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,6 @@ | |
<meta charset="utf-8" /> | ||
<title>My page</title> | ||
<meta name="viewport" content="initial-scale=1, width=device-width" /> | ||
<script | ||
src="https://unpkg.com/react@latest/umd/react.development.js" | ||
crossorigin="anonymous" | ||
></script> | ||
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.development.js"></script> | ||
<script | ||
src="https://unpkg.com/@mui/material@latest/umd/material-ui.development.js" | ||
crossorigin="anonymous" | ||
></script> | ||
<script | ||
src="https://unpkg.com/@babel/standalone@latest/babel.min.js" | ||
crossorigin="anonymous" | ||
></script> | ||
<!-- Fonts to support Material Design --> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
|
@@ -26,91 +13,32 @@ | |
/> | ||
<!-- Icons to support Material Design --> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"react": "https://esm.sh/[email protected]", | ||
"react-dom": "https://esm.sh/[email protected]", | ||
"react/jsx-runtime": "https://esm.sh/[email protected]/jsx-runtime", | ||
"@mui/material": "https://esm.sh/@mui/material?external=react" | ||
} | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="text/babel"> | ||
const { | ||
colors, | ||
CssBaseline, | ||
ThemeProvider, | ||
Typography, | ||
Container, | ||
createTheme, | ||
Box, | ||
SvgIcon, | ||
Link, | ||
} = MaterialUI; | ||
|
||
// Create a theme instance. | ||
const theme = createTheme({ | ||
palette: { | ||
primary: { | ||
main: '#556cd6', | ||
}, | ||
secondary: { | ||
main: '#19857b', | ||
}, | ||
error: { | ||
main: colors.red.A400, | ||
}, | ||
}, | ||
}); | ||
|
||
function LightBulbIcon(props) { | ||
return ( | ||
<SvgIcon {...props}> | ||
<path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z" /> | ||
</SvgIcon> | ||
); | ||
} | ||
|
||
function ProTip() { | ||
return ( | ||
<Typography sx={{ mt: 6, mb: 3, color: 'text.secondary' }}> | ||
<LightBulbIcon sx={{ mr: 1, verticalAlign: 'middle' }} /> | ||
{'Pro tip: See more '} | ||
<Link href="https://mui.com/material-ui/getting-started/templates/">templates</Link> | ||
{' in the Material UI documentation.'} | ||
</Typography> | ||
); | ||
} | ||
|
||
function Copyright() { | ||
return ( | ||
<Typography variant="body2" color="text.secondary" align="center"> | ||
{'Copyright © '} | ||
<Link color="inherit" href="https://mui.com/"> | ||
Your Website | ||
</Link>{' '} | ||
{new Date().getFullYear()} | ||
{'.'} | ||
</Typography> | ||
); | ||
} | ||
<!-- Babel --> | ||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | ||
<!-- Usage --> | ||
<script type="text/babel" data-type="module"> | ||
import * as React from 'react'; | ||
import { createRoot } from 'react-dom'; | ||
import { Button } from '@mui/material'; | ||
|
||
function App() { | ||
return ( | ||
<Container maxWidth="sm"> | ||
<Box sx={{ my: 4 }}> | ||
<Typography variant="h4" component="h1" sx={{ mb: 2 }}> | ||
Material UI CDN example | ||
</Typography> | ||
<ProTip /> | ||
<Copyright /> | ||
</Box> | ||
</Container> | ||
); | ||
return <Button variant="contained">Button</Button>; | ||
} | ||
|
||
const root = ReactDOM.createRoot(document.getElementById('root')); | ||
root.render( | ||
<ThemeProvider theme={theme}> | ||
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} | ||
<CssBaseline /> | ||
<App /> | ||
</ThemeProvider>, | ||
); | ||
createRoot(document.getElementById('root')).render(<App />); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.