-
Notifications
You must be signed in to change notification settings - Fork 137
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
Separate css in production build #30
Comments
👍 Also agreed - webpack's styling methods are really not great for production work. I have found that I can't get around the styling without using i.e. I can access the style sheet separately if I were using import 'react-scrollbar/src/less/scrollbar.less';
import 'react-scrollbar/src/less/site.less'; And this way I have options. I don't think people expect CSS to be built inline like this. You could also expose a main file that uses the inline style and create another file without it i.e. import 'react-scrollbar/src/less/scrollbar.less';
import 'react-scrollbar/src/less/site.less';
import ScrollArea from './scrollArea.jsx';
export default ScrollArea; And the one without: import ScrollArea from './scrollArea.jsx';
export default ScrollArea; |
As my colleague pointed out, obviously people can get around this with CSS specificity but I expect most would rather not. |
Hi, @marksyzm I like your idea about creating two dist files. One(default) with inline styles and another without it. So do you think that it's a good solution or you prefer only one, default file without inline styles? |
@souhe I think it'll be great to have main file with inline styles, and another one without inline css (plus third extracted css, or we can still use less from src). It's easy to add resolve.alias to webpack's config to import new files from node_modules folder with short syntax. |
Yeah, same, main file with, optional one without, so I could do: var ScrollArea = require('react-scrollbar/no-css'); or import ScrollArea from 'react-scrollbar/no-css'; |
Ok, i'll do that. |
require('react-scrollbar/no-css'); is supported since now in version v0.4.0 |
Hi. Thank you for nice component.
I faced with issue with react server rendering, when runtime can't access
navigator.userAgent
and rendering fails. I looked into and found that it is style-loader and itsisOldIE
method (https://github.com/webpack/style-loader/blob/6664a954/addStyles.js#L13).I used quick and dirty workaround — custom production build config with
ExtractTextPlugin
to build css into separate file.Maybe it is good to do so in your component. Or maybe you can explain, why you choose inline css.
The text was updated successfully, but these errors were encountered: