fix(breakpoints): keep fractional values from themes - #262
Merged
Merged
Conversation
Ghost Framework themes such as CyberPulse hand Ghost Kit breakpoints like 777.98 through the gkt_default_breakpoint_* filters, so their max-width queries never overlap the min-width ones at fractional viewport widths. The SCSS compiler wrote them as given; the replacement cast them to integers and shifted every query by a fraction of a pixel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ghost Framework themes (Horr, CyberPulse and the others built on it) set Ghost Kit's breakpoints through the
gkt_default_breakpoint_*filters, and CyberPulse hands over fractions such as777.98so itsmax-widthqueries never overlap itsmin-widthones at fractional viewport widths. The SCSS compiler wrote those values as given; the replacement from #259 cast them to integers, so every query moved by a fraction of a pixel and no longer matched the theme's own. The value is now kept as the theme gave it:777.98stays777.98px,"700"and700.0become700px, a non-numeric value leaves the default in place.Checked with the real
Ghost_Framework_Breakpointsclass and CyberPulse's numbers loaded as an mu-plugin on a wp-env site: Ghost Kit reports{"xs":567.98,"sm":777.98,"md":1077.98,"lg":1387.98}, the generateduploads/ghostkit/build/gutenberg/style.cssserved on a page with a Ghost Kit block carries(max-width:567.98px),(max-width:777.98px),(max-width:1077.98px),(max-width:1387.98px), and the editor variable resolves to(max-width: 777.98px). Unit test added;npm run test:unit:phpOK (68 tests, 128 assertions),npm run lint:phpclean.Belongs in 3.7.2 (#261) since the integer cast never shipped.