Closed lucasvallenet closed 9 months ago
Latest commit: |
7e70e2a
|
Status: | ✅ Deploy successful! |
Preview URL: | https://c5688c9a.locomotive-boilerplate.pages.dev |
Branch Preview URL: | https://feature-mediaqueries.locomotive-boilerplate.pages.dev |
Hello! It didn't work straight away on my side. I pushed a fix that update the functions names and I corrected typos inside the SCSS functions.
I like the idea of using scss
function for our media queries. I think the function names are clear and I can see myself using this utils. Vouched.
Description:
Update the media queries system with a Sass list.
This is going to lighten the Sass syntax and prevent media queries mistakes (ex:
@media (min-width: $to-large)
). It will also allow us to loop through each breakpoints to create utility classes for example.I created four functions to compose the desired media query:
mq($breakpoint, $type: "min")
— Creates amin-width
ormax-width
media query expression.mq-min($breakpoint)
— Alias ofmq($type: "min")
; Creates amin-width
media query expression.mq-max($breakpoint)
— Alias ofmq($type: "max")
; Creates amax-width
media query expression.mq-between($breakpointMin, $breakpointMax)
— Creates a min-width and max-width media query expression.Use:
Old syntax
New syntax
Advantage:
The Sass list allows us to loop through each breakpoints to create utility classes.
Example
This will return a class for each breakpoint like so:
.u-display-block@small
and.u-display-block@small-max