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

SASS @extend rule: strange output #76

Closed
ghost opened this issue May 9, 2011 · 1 comment
Closed

SASS @extend rule: strange output #76

ghost opened this issue May 9, 2011 · 1 comment
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented May 9, 2011

Hey there,

I have a problem using the @extend rule in sass.

I have the following rules in the .scss file:

.box {width:100px;}
.wrapper {background:black;}

.box.wrapper {margin-right:8px;}

.box1 {@extend .box; @extend .wrapper; background:red;}
.box2 {@extend .box; @extend .wrapper; background:green;}

The output in the css file is as follows:

.box, .box1, .box2 {width: 100px; }

.wrapper, .box1, .box2 {background: black; }

.box.wrapper, .box1, .box1.box2, .box2 {margin-right: 8px; }

.box1 {background: red; }

.box2 {background: green; }

Everything is correct except for the combination .box1.box2 in this line:

.box.wrapper, .box1, .box1.box2, .box2 {margin-right: 8px; }

Why does the algorithm combine .box1.box2 and so forth and applys the rule that I had specified for .box.wrapper?

It gets very bloated, especially with more classes, because it should just say:

.box.wrapper, .box1, .box2 {margin-right:8px;}

Am I missing something?
Is the interpretation from scss to css correct?
Can I somehow avoid this redundant code?

@nex3
Copy link
Contributor

nex3 commented Feb 14, 2012

.box1.box2 should indeed be omitted here, since it's a subselector of both .box1 and .box2. I'll look into it.

@nex3 nex3 closed this as completed in db51415 Feb 17, 2012
unicornrainbow pushed a commit to unicornrainbow/sass that referenced this issue Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant