Skip to content

Commit

Permalink
[docs] Add a note on the name option and dangerouslyUseGlobalCSS (#12281
Browse files Browse the repository at this point in the history
)
  • Loading branch information
oliviertassinari authored Jul 26, 2018
1 parent b536aec commit 04b7ccd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/src/pages/customization/css-in-js/css-in-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ As well as the option to make the class names **deterministic** with the `danger
- development: `.MuiAppBar-root`
- production: `.MuiAppBar-root`

⚠️ **Be very cautious when using `dangerouslyUseGlobalCSS`.**
We provide this option as an escape hatch for quick prototyping,
but you should avoid relying on it for code running in production
as it's very hard to keep track of class name API changes.
Global CSS is inherently fragile.
⚠️ **Be cautious when using `dangerouslyUseGlobalCSS`.**
We provide this option as an escape hatch for quick prototyping.
Relying on it for code running in production has the following implications:
- Global CSS is inherently fragile. People use strict methodologies like [BEM](http://getbem.com/introduction/) to workaround the issue.
- It's harder to keep track of `classes` API changes.

⚠️ When using `dangerouslyUseGlobalCSS` standalone (without Material-UI), you should name your style sheets. `withStyles` has a name option for that:
```jsx
const Button = withStyles(styles, { name: 'button' })(ButtonBase)
```

## CSS injection order

Expand Down

0 comments on commit 04b7ccd

Please sign in to comment.