Add error handling for bp mixins

Created on 16 January 2024, 12 months ago
Updated 19 January 2024, 12 months ago

Problem/Motivation

When using a breakpoint with the bp-min or bp-max mixins that is not defined in $grid-breakpoints, the content is printed out without being wrapped in a media query which will likely lead to unexpected output. This should fail with a useful error instead.

Solution

Print a useful error message so the issue gets fixed immediately.

Error: "[ sm-desktop ] is not defined in $breakpoints. Found: [ xsmall, small, medium, tablet, large, xlarge, xxlarge ]. Make sure the breakpoint you are trying to use is defined."
   ╷
67 │           @include bp.bp-min($breakpoint) {
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  libraries/partials/mixins/_typography.scss 67:11  typography-styles()
  libraries/global/settings/typography.scss 64:1    @use
  libraries/global/wysiwyg.scss 17:1   
Feature request
Status

Fixed

Version

5.2

Component

Code

Created by

🇺🇸United States pixelwhip

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024