Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Re-declare mixins _after_ they are used #240

Open
powerbuoy opened this Issue · 4 comments

3 participants

@powerbuoy

I know we can already re-declare @mixins like this:

@mixin foo {color: red}
@mixin foo {color: blue}
p {@include foo}

Becomes:

p {color: blue}

However, something I noticed today is that if the @include comes
before the re-declaration it won't take:

@mixin foo {color: red}
p {@include foo}
@mixin foo {color: blue}

Becomes:

p {color: red}

I would like it, too, to become:

p {color: blue}
@chriseppstein

I think this warrants some thought, but it's a big deal to change this behavior. you're going to have to work around this limitation for now.

@chriseppstein

Can you provide some more details on your use case. why can't you simply restructure your code?

@powerbuoy

Sure, here's what I wrote to Nathan before:

It may seem like my problem could be solved quite easily by moving
code around, the problem is that I work in a framework that supports
extending sites and styles and when you do that your site's CSS code
will come last in the generated CSS-file (which is obviously
necessary for specificity reasons). So if I extend one site that
declares and uses a lot of mixins, but then from my own site want to
override one of those mixins the overridden mixin will only be used in
my own code - not the code in the extended site.

Edit: A simple example would be the style I extend declares a blue @button and uses it in several places but in my new style I'd like the button to be green so it would be awesome to just go @mixin button {background: green} and change my own buttons as well as the other style's buttons.

@nex3
Owner

This is analogous to the change we've been considering for a while to the variable semantics to bring them in line with the proposals being made to CSS proper. If we change one, we'll certainly have to change the other.

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.