2

How do I get media queries to work in bootstrap? I have a SCSS file, I think I need to import something but I have no idea what.

Error message:

Scss compiler error: Error: no mixin named media-breakpoint-up

Path: homepage.scss

@include media-breakpoint-up(sm) {
  h1.home-page {
    font-size: 3rem;
  }
}
zen
  • 980
  • 6
  • 18
bp123
  • 3,217
  • 8
  • 35
  • 74

1 Answers1

3

You could @import the entire "bootstrap" scss, and then define the custom @include...

@import "bootstrap";

@include media-breakpoint-up(sm) {
  h1.home-page {
    font-size: 3rem;
  }
}

or, you can import functions, variables and mixins (since this includes only what is needed for the mixin)...

@import "bootstrap/functions";
@import "bootstrap/variables";
@import "bootstrap/mixins";

/* change col style on sm only */
@include media-breakpoint-up(sm) {
  h1.home-page {
    font-size: 3rem;
  }
}

@import "bootstrap";

It all depends on what other customizations you have.

https://codeply.com/go/3zTbKtczVd


Also see: How to extend/modify (customize) Bootstrap 4 with SASS

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624