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

[RFC] CSS Modules → JSS #207

Closed
wants to merge 5 commits into from
Closed

[RFC] CSS Modules → JSS #207

wants to merge 5 commits into from

Conversation

sapegin
Copy link
Member

@sapegin sapegin commented Oct 30, 2016

Why:

  • Easy to override styles via style guide config.
  • Very easy to override colors and fonts via style guide config.
  • Styles isolation (with jss-isolate plugin).

Styles overriding:

 module.exports = {
    title: 'React Style Guide Example',
+   theme: {
+       link: 'red',
+   },
+   styles: {
+       ComponentsList: {
+           item: {
+               borderLeft: '1px solid blue',
+           },
+       },
+   },
};

What do you think?

@aaronjensen
Copy link
Member

Looks good to me. I'm still using the default styling, but having an easier way to override it seems like a win. One thing I wonder about is if the jss-isolate will affect the actual styleguided components base/global styles (things like box-sizing, font-family, color, etc.) I don't add them to each component, I just set them globally.

@sapegin
Copy link
Member Author

sapegin commented Oct 30, 2016

Good point, I’ll check it.

@sapegin
Copy link
Member Author

sapegin commented Oct 30, 2016

Something to think about: https://github.com/theme-standard/spec

@mik01aj
Copy link
Collaborator

mik01aj commented Oct 31, 2016

I don't know much about JSS in particular, but I remember being excited about the CSS-in-JS approach, then asking on SO if this was actually a good idea, and finally realizing that CSS as such actually makes a lot of sense. Around that time I also read a great followup on this discussion from @keithjgrant.

So, proceed with caution :)

@sapegin
Copy link
Member Author

sapegin commented Oct 31, 2016

@mik01aj I don’t believe in separation of CSS and JS ;-) but I still prefer CSS for its syntax and especially for available tooling.

But here is not a regular site and even not a regular web app. Wee need our styles to be isolated from user styles: user styles (especially global styles like typography) shouldn’t affect style guide UI and vice versa.

So I think JSS if a good solution for Styleguidist. It makes style overriding simpler and it’s not that hard to write it (and we don’t have a lot of styles anyway).

@sapegin sapegin added this to the 5.0.0 milestone Nov 1, 2016
@sapegin sapegin mentioned this pull request Nov 11, 2016
9 tasks
# Conflicts:
#	loaders/styleguide.loader.js
#	src/index.js
#	src/rsg-components/ComponentsList/ComponentsListRenderer.js
#	yarn.lock
@sapegin sapegin changed the base branch from master to next November 19, 2016 16:48
@sapegin sapegin changed the base branch from next to master November 19, 2016 16:49
@sapegin
Copy link
Member Author

sapegin commented Nov 19, 2016

Merged to next branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants