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

Remove use-component-name-as-style-scope #18

Closed
franciscolourenco opened this issue Feb 20, 2017 · 5 comments
Closed

Remove use-component-name-as-style-scope #18

franciscolourenco opened this issue Feb 20, 2017 · 5 comments

Comments

@franciscolourenco
Copy link
Contributor

I would say this section is opinionated outside of the scope of Vue components, into a field of CSS which is controversial. It advises BEM and OOCSS which are methodologies which some people choose not to subscribe to knowingly.

Also exemplifies a kind of nesting one should probably avoid for a few reasons: MyCompoennt li {}

Also advises to use both <style scoped> along with css scoping, without explaining any substantial benefit.

https://github.com/pablohpsilva/vuejs-component-style-guide#use-component-name-as-style-scope

@yzb162534
Copy link

In our project, we always use component name as componet's root class.
We think it is useful to locate the component in html.

@franciscolourenco
Copy link
Contributor Author

@yzb161114 that makes total sense. What doesn't make a lot of sense is to recommend nesting css selectors AND using <style scoped>. Maybe you shouldn't nest at all because of increased specificity.

@pablohpsilva
Copy link
Owner

Hello @aristidesfl ! :D

I see... Well, I think using BEM and/or OOCSS will guarantee the component will always have a specific context. This section is there just to put two good practices together and make good use of them while building components.

I know that <style scope> will address that issue cleverly, but I think That's a good way of separating things in components.

Anyhow, please, make a PR changing what you see fit and let's talk about it.

Thank you again for your help @aristidesfl and @yzb161114

@pablohpsilva
Copy link
Owner

I will close this issue for now. It will be reopened when someone else has anything else to add about this matter.

Thank you @aristidesfl and @yzb161114! You guys rock! :D

@franciscolourenco
Copy link
Contributor Author

franciscolourenco commented Mar 5, 2017

Besides the readability issues which could result from the nesting:

  • Those css methodologies are outside of the main topic of the guide (if you want to keep it focused).
  • They compete with functionality offered by Vue. Vue doesn't require/benefit from that specific practice.
  • There are other places where people can read about available CSS methodologies more thourougly and make up their mind. As far as I've seen the opinions on this topic remain very scattered.
  • It takes advantage of a guide about one technology to promote another.
  • It might end up antagonising people who disagree with such CSS practices, and would otherwise follow the rest of the guide.

Didn't make a PR because I would be removing something you wrote, so.. its up to you take it out if you think this point of view makes sense. Cheers!

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

3 participants