Skip to content
This repository

@extend performance #12

Closed
thinkslate opened this Issue October 07, 2010 · 5 comments

5 participants

Devin Nathan Weizenbaum Devin Walters Chris Eppstein Miller Medeiros
Devin

Using @extend in SASS has resulted in massive selectors in CSS. One of my CSS selectors is 4000 characters long. Chrome has been crashing and I think it has to do this my use of @extend. Can you comment?

Nathan Weizenbaum
Owner

I'm not sure what sort of comment you're looking for. Yes, if you use @extend a lot on the same selector, that selector will expand a lot. I think @extend works in a reasonably predictable way and this is a reasonably predictable consequence. It's definitely unfortunate that browsers can't handle long selectors, but there's not really a great way to shorten them here. I suppose one suggestion I have is to avoid using @extend in nested selectors in areas where you have problems.

I'm closing this because it's not really a bug report or feature request. If you have concrete suggestions for improving the situation, feel free to re-open.

Devin Walters

nex3: That's pretty much all I was looking for -- I appreciate the explanation. Mainly, I am not very familiar with how @extendis implemented and wanted to know if there might be something in the sauce that could predictably and unduly expand in the process of using them.

Thanks again,
Devin

Chris Eppstein
Collaborator

defn, if you can please look at your output and tell use what selectors you think should not have been generated, then we can discuss why they are there and what can be done about it. Please send this information to the mailing list tho instead of using the bug tracker. http://groups.google.com/group/sass-lang

Miller Medeiros

if the amount of selectors is too large they could be broken into multiple rules and just repeat all the attributes (like a mixin would do).

Devin Walters

I realize this has been closed for some time now, but since there was a recent comment it caught my attention. I think it would have been helpful in retrospect to define some sort of reasonable threshold for max_selector_length_before_warning to let the user know about the gigantic selectors being produced as a result of misusing @extend. Food for thought.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.