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

How to update a global variable from mixin or function? #1511

Closed
hittas opened this issue Nov 6, 2014 · 2 comments
Closed

How to update a global variable from mixin or function? #1511

hittas opened this issue Nov 6, 2014 · 2 comments

Comments

@hittas
Copy link

hittas commented Nov 6, 2014

For example:

$flex-legacy: ();

@mixin my-flex($param) {
    @if $flex-support == false {
        $flex-legacy: map_merge($flex-legacy, (nth(&, 1): $param)); // need global
    } @else {
        @include flexbox($params, $version: 3); // mixin from compass
    }
}

#container {
    @include my-flex((display: flex));
}

@debug $flex-legacy; // now empty but I need (#container: (display: flex))
@hittas hittas changed the title How to set a global variable from mixin or function? Nov 6, 2014
@nex3
Copy link
Contributor

nex3 commented Nov 6, 2014

Use the !global flag:

$flex-legacy: ();

@mixin my-flex($param) {
    @if $flex-support == false {
        $flex-legacy: map_merge($flex-legacy, (nth(&, 1): $param)) !global; // need global
    } @else {
        @include flexbox($params, $version: 3); // mixin from compass
    }
}
@nex3 nex3 closed this as completed Nov 6, 2014
@hittas
Copy link
Author

hittas commented Nov 6, 2014

Indeed, thanks! It's my fault :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants