JSS plugins customisation and global styles [@next]
See original GitHub issue@oliviertassinari sorry to bother… I’m trying to apply global rules I have defined in a NPM package @damianobarbati/jss-reset
to the app but I don’t find in the docs how to directly use the jss instance MUI is using.
Docs say Material-UI is using the jss-preset-default module. You can always add new plugins if needed
: but how? 🤔
I also tried to apply globals in a random app component:
const styleSheet = createStyleSheet('List', theme => ({
'@global': {
body: {
margin: 0,
padding: 0,
},
},
root: {
And I tried to apply globals in the theme creation:
const theme = createMuiTheme({
'@global': {
body: {
margin: 0,
padding: 0,
},
},
Does not seem to work.
For reference I’m using this in an another app (react-jss@latest ~ 1.7):
import React from 'react';
import ReactDOM from 'react-dom';
import { create as createJss } from 'jss';
import { JssProvider } from 'react-jss';
import preset from 'jss-preset-default'
import reset from '@damianobarbati/jss-reset';
//const App = blablabla
const jss = createJss(preset());
jss.createStyleSheet(reset).attach();
ReactDOM.render(<JssProvider jss={jss}><App /></JssProvider>, document.getElementById('app'));
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
JSS plugins customisation and global styles [@next] #7430
I'm trying to apply global rules I have defined in a NPM package ... JSS plugins customisation and global styles [@next] #7430.
Read more >Basic Features: Built-in CSS Support - Next.js
Next.js supports including CSS files as Global CSS or CSS Modules, using `styled-jsx` ... For example, consider the following stylesheet named styles.css :...
Read more >Global vs. Local Styling In Next.js - Smashing Magazine
The answer is surprisingly simple — to write well-structured CSS that balances global and local styling concerns.
Read more >JSS integration with React
Install; Basic; Dynamic Values; Prefix classname; Theming; Accessing the theme inside the styled component; Accessing the theme without styles; Using custom ...
Read more >Global Styles in Next.js - Netlify
CSS Modules, Styled JSX, Sass, Less, Stylus, Styled Components, Emotion... I could go on! If you want to style a component, Next.js has...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK figured it out (often takes writing an issue to do that). @damianobarbati this might be useful to you but I’m sure you’ve figured it out already. You don’t need to use customs JSS.
Add
@global
defs to a style (not theme) then style your root element.@oliviertassinari
Please add this example code to the documentation for Customization > CSS in JS. It mentions the
JssProvider
but does not mention how it fits into theMuiThemeProvider
at all.