-
Notifications
You must be signed in to change notification settings - Fork 175
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
The recomendations of @extend are concerning #9
Comments
I partially agree... I'm considering changing the recommendation to mixins. It should be very easy in Less:
...but not so much on Sass or Stylus. Comments welcome on that one. |
Semi-relevant: http://ricostacruz.com/til/extend-sucks |
@jamesmacfie I agree with your example, but that markup makes useless the use of @extend at all. I think the example from @rstacruz isn't the best to explain the need for @extent (or mixins) for nested components. |
Take a look at this: http://www.smashingmagazine.com/2015/05/extending-in-sass-without-mess It's very much inline with RSCSS and the selectors can easily adapt RSCSS syntax to fit the guidelines suggested above. |
I like what you've got going here, but by using
@extend
when nested inside a descendent selector, the final comma separated CSS selectors can be a nightmare. Keeping final CSS output in mind is vital to successfully scaling any CSS/Sass solution.If you're going to use
@extend
in different files for different components, then the final CSS selector can not only be a mess of selectors, but you also potentially create a relationship between classes that shouldn't have a relationship. You've advised putting all components in their own file (nice), but by linking classes via@extend
then your final CSS and selectors are no longer grouped by component only; they're also grouped by some shared properties.If you've decided that you want all the CSS properties of a class, then just add the class to the component instead of using
@extend
. You're final CSS output will be smaller, there's less need for sourcemaps to figure out where a rule came from (actually, I don't even know how well source maps deal with@extend
to be honest), and the HTML becomes much clearer to any developer that views it.Ignoring that
.search-button
wouldn't be an ideal class name in the first place here, the HTML in your@extend
example might become something like:The text was updated successfully, but these errors were encountered: