-
Notifications
You must be signed in to change notification settings - Fork 4
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
Question: can Styling be full CSS replacement? #9
Comments
Styling is primarily targeted for defining component styles and so it doesn't have any API for defining global styles. Though there's an undocumented hook which allows generating arbitrary CSS:
I wouldn't recommend it though. Instead I think global styles like |
Ok, got your vision. Sad, but looks like regular CSS still the only way to introduce some global styles. Anyway I still have one question regarding nesting styles. What if I have some list component, import Styles from "./styles/Articles.js";
class Articles extends Component {
articleItem(article) {
return <li key={`article-${article.id}`}>{article.title}</li>;
};
render() {
const {data} = this.state;
return (
<ul className={Styles.self}>
{data.map(this.articleItem)}
</ul>
);
}
} How do I write next CSS rule with styling? ul li {
...
} I tried something like, import styling from "styling";
export const self = styling({
li: {
...
}
}); But that notation just generate |
Yeah, though I'd accept pull request with API for global styles. There's still a use case for that because you'd probably want to share constants (colors, ...) between component styles and global styles.
So with React, I think, it's better not to allow uncontrolled extensions and that's applicable to styling to. I think it's better to define another CSS class and pass it to children:
|
I really love idea of Styling and how easy it could be integrated into the project, but from the docs and current state looks like it only suitable for providing additional styles for the web components.
But what if I need an ability to describe all my styles via Styling? Yes, still using some normalization library like
normalize.css
, but no other CSS Frameworks, like Bootstrap, Foundation and others. Is it possible?In theory I'm thinking that my
app.js
could have something like,when
./styles/Global.js
contains,Does it make sense? Or maybe there is other solution for my needs?
ps. I've seen JSS initiative, but have feeling that Styling fits my needs much better than JSS
The text was updated successfully, but these errors were encountered: