You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that it is related to #1525. It is almost the same problem - namespace with foreign syntax on it. So, the solution could be exactly the same: ignore namespace with guard (whether satisfied or not).
I think ideally we would need to throw a error on #ns > .mixin() if #ns is parametric or has guards... But that's ideally (assuming it's quite minor issue so far, so it would make sense to declare both as "not quite officially supported". Otherwise we would have to add guard test into the mixin match search (not that easy, minus perf.) and allow #ns(parameters...) > .mixin() which is yet another big story).
If namespaces with guards are skipped, then we can not add support for them later on without breaking existing sheets. So, error might be more future safe.
Namespaces with parameters would be more user friendly if they are simply skipped, there is no reason not to allow them. Even if such support would added later on, it would break nothing.
When I said skip, I meant skip if the condition fails.. but actually we
dont know if the condition passes at the mixin call stage, so probably an
error is better.
Is it difficult to test the condition at that stage? I'm just curious. The namespace have to be compiled before looking for mixins in it (because of import mixin feature) anyway.
I guess the main problem is that mixins are expanded before variables are evaluated (because mixin expansion can bring a new variable into the scope (or override existing one)). That's why we also have a few issues with variables not always working when using interpolated selectors as mixins (i.e. now we have mixins affecting variables and variables affecting mixins -> cycle dependencies).
Activity
lukeapage commentedon Feb 23, 2014
I don't think its a bug
its just a css selector with a guard on it e.g.
which also gives the same output as...
possibly that last example is a bug.
But yes I would say we just can't use guards like this.
seven-phases-max commentedon Feb 23, 2014
I think ideally we would need to throw a error on
#ns > .mixin()if#nsis parametric or has guards... But that's ideally (assuming it's quite minor issue so far, so it would make sense to declare both as "not quite officially supported". Otherwise we would have to add guard test into the mixin match search (not that easy, minus perf.) and allow#ns(parameters...) > .mixin()which is yet another big story).SomMeri commentedon Feb 23, 2014
@seven-phases-max
#ns(parameters...) > .mixin()sounds like a cool feature :). Not sure how useful it would be through.lukeapage commentedon Feb 23, 2014
I agree an error or just skipping (maybe skipping all () mixins and
skipping selectors on guards that fail) would make more sense.
SomMeri commentedon Feb 24, 2014
If they are skipped, then we can not add this feature inside later on without breaking existing sheets. So, error might be more future safe.
SomMeri commentedon Feb 24, 2014
I hit comment too soon, edited clearer version.
If namespaces with guards are skipped, then we can not add support for them later on without breaking existing sheets. So, error might be more future safe.
Namespaces with parameters would be more user friendly if they are simply skipped, there is no reason not to allow them. Even if such support would added later on, it would break nothing.
lukeapage commentedon Feb 24, 2014
When I said skip, I meant skip if the condition fails.. but actually we
dont know if the condition passes at the mixin call stage, so probably an
error is better.
SomMeri commentedon Feb 24, 2014
Is it difficult to test the condition at that stage? I'm just curious. The namespace have to be compiled before looking for mixins in it (because of import mixin feature) anyway.
seven-phases-max commentedon Feb 24, 2014
I guess the main problem is that mixins are expanded before variables are evaluated (because mixin expansion can bring a new variable into the scope (or override existing one)). That's why we also have a few issues with variables not always working when using interpolated selectors as mixins (i.e. now we have mixins affecting variables and variables affecting mixins -> cycle dependencies).
lukeapage commentedon Feb 24, 2014
exactly. and this is also why imports with variables only work in an extremely limited way
SomMeri commentedon Sep 7, 2014
Closing this since it was fixed by #2180 and will go into v2.0.