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

Mixin Undefined for Namespaced Mixins On Root Level #1682

Closed
srsgores opened this issue Nov 27, 2013 · 2 comments
Closed

Mixin Undefined for Namespaced Mixins On Root Level #1682

srsgores opened this issue Nov 27, 2013 · 2 comments

Comments

@srsgores
Copy link

See the stackoverflow comment.

When calling a namespaced mixin from the root level (no parent selector), I get the following error:

SyntaxError: .keyframes is undefined

Here is an example:

#animation {
    .keyframes (@name, @from, @to, @vendor:"", @bind:"") {
        @keyf: ~"@{bind}@@{vendor}keyframes @{name} { `'\n'`from ";
        @{keyf} {
            .from(@name,@from);
        }
        to {
            .to(@name,@to);
        }
    }

    .animation-keyframes (@name, @from, @to, @anim-selector) {
        @bind: "} `'\n'`";
        .keyframes (@name, @from, @to, "-moz-");
        .keyframes (@name, @from, @to, "-webkit-", @bind);
        .keyframes (@name, @from, @to, "-o-", @bind);
        .keyframes (@name, @from, @to, "-ms-", @bind);
        .keyframes (@name, @from, @to, "", @bind);
        @anim: ~"} `'\n'`.@{anim-selector}";
        @{anim} {
            -moz-animation: @name;
            -webkit-animation: @name;
            -o-animation: @name;
            -ms-animation: @name;
            animation: @name;
        }
    }
}

And calling it:

.from (colors, @color) {
    color: @color;
}
.to (colors, @color) {
    color: @color;
}

/* keyframes with all vendor prefixes */
#animation > .animation-keyframes (colors, red, blue, my-colanim);
@seven-phases-max
Copy link
Member

See #719, #996.

Workarounds:

A. You can use a fully-qualified names to access sibling mixins from .animation-keyframes (i.e. use #animation.keyframes instead of just .keyframes).

B. Expand #animation into current scope first, i.e.:

#animation;
.animation-keyframes(colors, red, blue, my-colanim);

(Though, if currect scope is the global one, this makes the namespace itself to be redundant).

@seven-phases-max
Copy link
Member

Closing as duplicate of #996.

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

No branches or pull requests

2 participants