- Create mymodule.breakpoints.yml in your module's base directory. This file will hold the breakpoint configurations.
- Firstly, we will add a standard mobile breakpoint that does not have a media query, following mobile first practices:
mymodule.mobile: label: Mobile mediaQuery: '' weight: 0
- Secondly, we will create a standard breakpoint that will run on a larger viewport:
mymodule.standard: label: Standard mediaQuery: 'only screen and (min-width: 60em)' weight: 1
- Thirdly, we will create a wide breakpoint for devices that have a large viewport:
mymodule.wide: label: Wide mediaQuery: 'only screen and (min-width: 70em)' weight: 2
- Your mymodule.breakpoints.yml should resemble the following:
mymodule.mobile:
label: Mobile
mediaQuery: ''
weight: 0
mymodule.standard:
label: Standard
mediaQuery: 'only screen and (min-width: 60em)'
weight: 1
mymodule.wide:
label: Wide
mediaQuery: 'only screen and (min-width: 70em)'
weight: 2
- Go to the Configuration tab and then to Performance to rebuild Drupal's cache and make the system aware of the new breakpoints.