Verify that mixin is being called from within a media query

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Verify that mixin is being called from within a media query



I need to do a check in a mixin, to know if it's being called from within a media query. It's possible?


@mixin test {

@if [is within a media query?] {
...
} @else {
...
}

}

@media (min-width: 768px) {
@include test;
}




1 Answer
1



You could use the @debug (<= 3.3) or @error (>=3.4) to output to the console from within the mixin to check if it has been compiled (this would assume you can isolate the usage of the mixin to this media query for this test). There isn't a way to use @if in Sass as you are asking about.



http://sass-lang.com/documentation/file.SASS_REFERENCE.html#error






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

9G3tzI5Whw pKRHQIeHFk stTnS Ug25 g
2K8SYk,hE,Zhn b

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty