-
Notifications
You must be signed in to change notification settings - Fork 339
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
Media query with $until fails #1674
Comments
Hey @edwardhorsford, I've tried to reproduce your issue here: https://govuk-frontend-issue-1674.glitch.me html::before {
position: absolute;
background: white;
padding: 5px;
font-family: sans-serif;
@extend %until-mobile-only;
@extend %mobile-only;
}
%until-mobile-only {
@include govuk-media-query($until: mobile) {
content: 'govuk-media-query($until: mobile)';
}
}
%mobile-only {
@include govuk-media-query(mobile) {
content: 'govuk-media-query(mobile)';
}
} And it seems to output as expected, could you provide some steps to reproduce the issue you're running into please? Update: It fails only when |
@NickColley I wonder if this might be a compiler issue / incompatibility. Your exact snippet above fails for me - we're using My snippet also failed for @hannalaakso - so perhaps she can demo. In the end I've worked around it. |
above snippet will fail to compile in moving to |
I can replicate this in the latest version of the kit (but not in FE review app for instance) with:
|
OK so this is a bit of a twisty one but I think I've gotten to the bottom of it. What is happening is that when the Internet Explorer 8 version of the application.css is built. It sets the This then sets the
This means that when the mixin runs, it outputs nothing, which means your placeholder So you'll see this error message: Error: "html::before" failed to @extend "%until-mobile-only".
The selector "%until-mobile-only" was not found.
Use "@extend %until-mobile-only !optional" if the extend should be able to fail.
on line 26 of app/assets/sass/application-ie8.scss
>> @extend %until-mobile-only; I think the differences between compilers/wrappers is perhaps how they handle errors in this case. I have updated my example to include the I'm have also raised an issue with sass-mq to see if we can make this better without work arounds: sass-mq/sass-mq#130 Workaround
%display-mobile-only {
@include govuk-media-query($until: mobile) {
display: none;
}
/* noop */
} or (recommended)
%display-mobile-only {
@include govuk-media-query($until: mobile) {
display: none;
}
}
.app-sidebar-hr {
// using !optional to work around the placeholder being empty in Internet Explorer 8 builds.
@extend %display-mobile-only !optional;
} I'm going to close this for now as I think this is the best I can offer at this point in time but if there's something I've missed or a better way to work around this feel free to re-open, thanks :) |
Thanks for investigating this @NickColley! |
I think I have a bug with the media queries.
The following will not work:
![Screenshot 2019-12-06 at 10 24 36](https://user-images.githubusercontent.com/2204224/70322786-eea58100-1822-11ea-87f8-fda4565e36eb.png)
If I change to
$from: tablet
it's fine. Weirdly it doesn't cause a compiler issue -but the css doesn't seem to be output.When trying with extend I get an error with the extend - but I think it's related to this mixin.
The text was updated successfully, but these errors were encountered: