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
current-media()
does not interpolate variables, selector()
does
#2128
current-media()
does not interpolate variables, selector()
does
#2128
Comments
Hi. To fix the problem with module.exports = function currentMedia(){
var self = this;
return new nodes.String(lookForMedia(this.closestBlock.node) || '');
function lookForMedia(node){
if ('media' == node.nodeName) {
node.val = self.visit(node.val); // magic happens here, the `val` property is the unresolved value of the media query (`$foo` ident in an expression in our case).
return node.toString();
} else if (node.block.parent.node) {
return lookForMedia(node.block.parent.node);
}
}
}; |
Fixed in the |
* dev: (21 commits) Fixed History for 0.54.0 History up Evaluate variables in current-media function. Fixes #2128 Undesired spaces with partial reference selector using ranges. Fixes #2133 Slightly clarified an issue with combinators at ranges in partial references, re: #2134 Validate regexp flags for match function Fix bug with evaluating default arguments Undesired spaces with partial reference selector using ranges. Fixes #2133 Fixed bug with selectors() function. Closes #2130 Don't parse empty imports Wrong errors with --include-css and --resolve-url used concurrently. Fixes #2125 misc fixes Docs and History up SelectorParser: Added initial reference selector BIFs: expose "url" function by "embedurl" Updated history Bump version BIFs: Added "index" function Updated docs that where merged incorrectly added a slice function ...
I'd like to fix this bug and am hoping a maintainer can point me in the right direction.
selector()
usesutils.compileSelectors()
to render a full selector string. It combines nested selectors and performs variable interpolation. However,current-media()
doesn't. Based on the way the latter is used in+cache()
, I'm guessing it is supposed to behave like the former?What's the best way to fix this? Should I implement a
utils.compileMedia()
? ac40442 seems to be a big media-query refactoring, and a good starting point for my implementation. Also, shouldcurrent-media()
be fixed, or should I add a new BIF that usesutils.compileMedia()
, leavingcurrent-media()
intact?I greatly appreciate any advice you can offer.
The text was updated successfully, but these errors were encountered: