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
the correct active state of each CSS breakpoint will be correctly exposed for the current viewport via the content property of the configured element's (default: body) ::after-pseudo-element.
Not working as expected:
Given a more complex Sass map that has breakpoints without a strictly ascending order of values, the active state will not always be exposed correctly to JavaScript.
This export plugin generates CSS by looping through the map, so in this case the last generated media query will be @media (min-width: 1200px) { … }. Due to the way the CSS cascade works, the content of the pseudo-element is always set by the last matching media query.
So for viewports bigger than 1200px, content will always contain the JSON string generated for the hero-switcharound breakpoint and the exposed breakpoint active state will always be false for wide-screen – even for viewports bigger than 1440px.
The text was updated successfully, but these errors were encountered:
polarbirke
added a commit
to polarbirke/include-media-export
that referenced
this issue
Apr 2, 2021
Add a map-sort helper and sort breakpoints before exporting JSON
strings in CSS media queries. This default behaviour can be opted-out
from by setting $im-dangerously-use-unsorted-breakpoints.
Add tests for functions and mixins. Split plugin into different files
that can be imported and tested individually. Add a build step to
publish the concatenated plugin file.
Fixeseduardoboucas#13
Working as expected:
Given a Sass map like include-media's default
the correct active state of each CSS breakpoint will be correctly exposed for the current viewport via the
content
property of the configured element's (default:body
)::after
-pseudo-element.Not working as expected:
Given a more complex Sass map that has breakpoints without a strictly ascending order of values, the active state will not always be exposed correctly to JavaScript.
This export plugin generates CSS by looping through the map, so in this case the last generated media query will be
@media (min-width: 1200px) { … }
. Due to the way the CSS cascade works, thecontent
of the pseudo-element is always set by the last matching media query.So for viewports bigger than 1200px,
content
will always contain the JSON string generated for thehero-switcharound
breakpoint and the exposed breakpoint active state will always befalse
forwide-screen
– even for viewports bigger than 1440px.The text was updated successfully, but these errors were encountered: