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

Please export createGenerateClassName and jssPreset #10858

Closed
1 task done
dantman opened this issue Mar 30, 2018 · 2 comments
Closed
1 task done

Please export createGenerateClassName and jssPreset #10858

dantman opened this issue Mar 30, 2018 · 2 comments
Assignees
Labels
good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request

Comments

@dantman
Copy link
Contributor

dantman commented Mar 30, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Sometimes it's necessary to customize the JssProvider as described here, when that happens it's necessary to import the createGenerateClassName and jssPreset from material-ui.

However currently index.js and index.es.js do not export these. In order to import these you have to directly import them from material-ui/styles instead of material-ui.

I think it's reasonable to expect that you can import {createGenerateClassName, jssPreset} from 'material-ui'; when it's valid to import {withStyles} from 'material-ui';.

The distaste with this is also the fact that material-ui/styles is an explicit module import. What is imported when you import material-ui is environment dependent because of the existence of both main and module. Importing material-ui/styles directly requires me to assume that I'm always in an environment where material-ui/styles is what material-ui imports for withTheme, etc... under the hood and it will never ever be material-ui/es/styles or material-ui/modules/styles.

Your Environment

Tech Version
Material-UI 1.0.0-beta.38
Material-UI-Icons 1.0.0-beta.36
React 16.2.0
WebPack 3.11.0
Babel 6.26.0
@oliviertassinari
Copy link
Member

@dantman I agree. Everything exported in the /styles/index.js file should be exported in the /index.js file.
https://github.com/mui-org/material-ui/blob/961edfa683355190e34f297855f7f0c0bdf5507a/src/styles/index.js#L1-L6
Do you want to work on it? :)

@oliviertassinari oliviertassinari added new feature New feature or request good first issue Great for first contributions. Enable to learn the contribution process. labels Mar 30, 2018
@dantman
Copy link
Contributor Author

dantman commented Mar 30, 2018

I'm finishing up today with things that just require explanations rather than coding and pull request creation. And tomorrow I'll probably have to upgrade material-ui and react for the new releases. But I'll consider making a PR once I'm done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants