Not really a problem but something I’m not happy with. I'm using react
+ typescript
+ css modules
+ https://material-ui-next.com/. Problem is that when I need to style material ui components I have to use !important
a lot. Question is if there is a way to create styles without important
. I create a sample project to reproduce the problem https://github.com/halkar/test-css-modules
I should've used JssProvider
and tell it to put material UI styles before mine in the page head
section.
import JssProvider from 'react-jss/lib/JssProvider';
import { create } from 'jss';
import { createGenerateClassName, jssPreset } from 'material-ui/styles';
const generateClassName = createGenerateClassName();
const jss = create(jssPreset());
// We define a custom insertion point that JSS will look for injecting the styles in the DOM.
jss.options.insertionPoint = document.getElementById('jss-insertion-point');
function App() {
return (
<JssProvider jss={jss} generateClassName={generateClassName}>
...
</JssProvider>
);
}
export default App;