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

CSS Convention - Scoping vs BEM vs OOCSS vs SMACSS #156

Open
merlinstardust opened this issue Mar 19, 2016 · 9 comments
Open

CSS Convention - Scoping vs BEM vs OOCSS vs SMACSS #156

merlinstardust opened this issue Mar 19, 2016 · 9 comments

Comments

@merlinstardust
Copy link
Contributor

Does Mantra have a preferred CSS convention?

@adamdawkins
Copy link

Not sure this feels like something Mantra should have an opinion on. With so many CSS Frameworks also used in UI development, it could be a bit hard to enforce.

+, for most intents and purposes, BEM, SMACSS and OOCSS are very much variants of the same school of CSS thought.

@arunoda
Copy link
Collaborator

arunoda commented Mar 22, 2016

Since the React community is going forward with CSS in JS, that's a kind of way we can go. We started with few projects with that and we are loving that.

Specially Radium allows us to do much better inline styling.

And I also like CSS frameworks which abstract the CPU via some React components. These are two such good projects:

@arunoda
Copy link
Collaborator

arunoda commented Mar 22, 2016

I also agree with @adamdawkins that there are so many ways to deal with CSS and we can't enforce one such way.

@natecox
Copy link

natecox commented Mar 23, 2016

I feel much the same way about this as I do about enforcing strict linting styles: people feel too strongly about the way CSS is structured, and it has little bearing on the functionality of the app, so I don't think we should try to impose a standard here. It's basically an invitation for evangelism and arguments.

@merlinstardust
Copy link
Contributor Author

There's definitely a lot of CSS methodologies out there just like there are lots of style recommendations for JavaScript. But it seems that Mantra is going to recommend an eslint config so I think recommending a CSS methodology is within the scope of the spec.

I do think that CSS in JS does seem to be the way forward after seeing this slide deck.

@arunoda
Copy link
Collaborator

arunoda commented Mar 30, 2016

I wrote an article on this too: https://voice.kadira.io/state-of-react-and-css-501d179443d3#.jwxj8y2ee

@fermuch
Copy link

fermuch commented Apr 6, 2016

The best tool I found so far is JSS. Pure js, and compiles to CSS.

You create a javascript file which exports an object, and that object has all the style definitions (check out the playground). When you need those styles, you can simply import them (since they're JS files), and use jss.createStyleSheet to compile the object to CSS.

It works well with mantra, since it doesn't need external compilers, and everything is self-contained. You can even write the definitions inside the component itself, and you don't have global style definitions, so everything is self contained in the component.

@v-anyukov
Copy link

@fermuch Hi! Did you try this https://github.com/jsstyles/react-jss? Cant make it work properly with mantra =(

@fermuch
Copy link

fermuch commented Apr 6, 2016

@v-anyukov take a look at this link.

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

No branches or pull requests

6 participants