pub struct Breakpoints { /* private fields */ }Expand description
Fail the build if a hand-written breakpoint has drifted from SizeClass.
Every pixel width named by a media or container query must be a
SizeClass boundary or one of the tuning widths. A
container query is checked the same way as a media query:
@container screen (width < 600px) states a width.
A width on a SizeClass boundary must also be written as an edge of the
partition, exclusive on one side: width < 600px and 600px <= width
pass, while max-width: 600px, width <= 600px and width > 600px fail,
because each also claims the point where the next class begins. A tuning
width may be written in either direction.
makeover_webview::build::drift::Breakpoints::in_frontend("frontend")
.tuning(&[1400])
.run();The generated stylesheets are scanned too, and pass: they take the number from makeover-geometry.
Implementations§
Source§impl Breakpoints
impl Breakpoints
Sourcepub fn in_frontend(frontend: impl AsRef<Path>) -> Self
pub fn in_frontend(frontend: impl AsRef<Path>) -> Self
Every .css under frontend/css and every .js under frontend/js,
recursively.
Sourcepub fn files<P: AsRef<Path>>(paths: &[P]) -> Self
pub fn files<P: AsRef<Path>>(paths: &[P]) -> Self
A named list of files rather than a tree.
For a frontend with no directory a scan can point at. A stylesheet not on the list is not checked.
A .js path is read as script and anything else as stylesheet.
Sourcepub fn tuning(self, widths: &[u16]) -> Self
pub fn tuning(self, widths: &[u16]) -> Self
Widths inside a shell where something reflows without the shell changing: a dashboard dropping from three columns to two, a pane’s width cap ending.
A tuning width does not move when a size class does. Each entry carries a note beside it in the caller saying what it tunes.
Sourcepub fn run(&self)
pub fn run(&self)
Run the check. Emits cargo::rerun-if-changed for every file it read,
and for the scanned directories.
§Panics
If a listed file cannot be read, including one that no longer exists;
if any width is neither a size-class boundary nor a tuning width; or if
a size-class boundary is written with an operator that straddles it
(max-width: 600px, width <= 600px).