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] Document the meta viewport #12541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/src/pages/getting-started/installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,18 @@ you must first install the [@material-ui/icons](https://www.npmjs.com/package@ma
```sh
npm install @material-ui/icons
```

## CDN

You can start using Material-UI with minimal Front-end infrastructure,
which is great for prototyping. We discourage using this approach in production though -
the client has to download the entire library, regardless of which components are actually used,
affecting performance and bandwidth utilisation.

#### UMD releases

We are providing two Universal Module Definition (UMD) files:
- one for development: https://unpkg.com/@material-ui/core/umd/material-ui.development.js
- one for production: https://unpkg.com/@material-ui/core/umd/material-ui.production.min.js

You can follow [this CDN example](https://github.com/mui-org/material-ui/tree/master/examples/cdn) to quickly get started.
22 changes: 21 additions & 1 deletion docs/src/pages/getting-started/usage/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Material-UI components work in isolation.
**They are self-supporting**, and will inject, and only inject, the styles they need to display.
They don't rely on any global style-sheets such as [normalize.css](https://github.com/necolas/normalize.css/),
although Material-UI does provide an optional [CssBaseline](/style/css-baseline) component.

You can use any of the components as demonstrated in the documentation.
Please refer to each component's [demo page](/demos/buttons/) to see how they should be imported.
Expand Down Expand Up @@ -34,6 +33,27 @@ Yes, this really is all you need to get started, as you can see in this live and

{{"demo": "pages/getting-started/usage/Usage.js", "hideHeader": true}}

## Globals

Material-UI usage experience can be improved with a handful of important global that you’ll need to be aware of.

### Responsive meta tag

Material-UI is developed mobile first, a strategy in which we first write code for mobile devices and then scale up components as necessary using CSS media queries.
To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your `<head>` element.

```html
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>
```

### CssBaseline

Material-UI provides an optional [CssBaseline](/style/css-baseline) component.
It's fixing some inconsistencies across browsers and devices while providing slightly more opinionated resets to common HTML elements.

## Versioned Documentation

This documentation always reflects the latest stable version of Material-UI.
Expand Down
2 changes: 1 addition & 1 deletion examples/cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ open index.html
## The idea behind the example

You can start using Material-UI with minimal Front-end infrastructure,
which is great for prototyping. Don't use this approach in production though -
which is great for prototyping. We discourage using this approach in production though -
the client has to download the entire library, regardless of which components are actually used,
affecting performance and bandwidth utilisation.

Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app-with-jss/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=0, initial-scale=1, minimum-scale=1, width=device-width, height=device-height">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no">
<!-- PWA primary color -->
<meta name="theme-color" content="#000000">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=0, initial-scale=1, minimum-scale=1, width=device-width, height=device-height">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no">
<!-- PWA primary color -->
<meta name="theme-color" content="#000000">
<!--
Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=0, initial-scale=1, minimum-scale=1, width=device-width, height=device-height">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no">
<!-- PWA primary color -->
<meta name="theme-color" content="#000000">
<title>My page</title>
Expand Down
5 changes: 1 addition & 4 deletions examples/nextjs/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ class MyDocument extends Document {
{/* Use minimum-scale=1 to enable GPU rasterization */}
<meta
name="viewport"
content={
'user-scalable=0, initial-scale=1, ' +
'minimum-scale=1, width=device-width, height=device-height'
}
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>
{/* PWA primary color */}
<meta name="theme-color" content={pageContext.theme.palette.primary.main} />
Expand Down
2 changes: 1 addition & 1 deletion examples/parcel/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>My page</title>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=0, initial-scale=1, minimum-scale=1, width=device-width, height=device-height">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
</head>
<body>
Expand Down
5 changes: 1 addition & 4 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class MyDocument extends Document {
{/* Use minimum-scale=1 to enable GPU rasterization */}
<meta
name="viewport"
content={
'user-scalable=0, initial-scale=1, ' +
'minimum-scale=1, width=device-width, height=device-height'
}
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>
{/*
manifest.json provides metadata used when your web app is added to the
Expand Down