Skip to content

Commit 647bbce

Browse files
committed
Auto merge of #4361 - Turbo87:breakpoints, r=locks
Use `postcss-custom-media` plugin for breakpoints This PR adds the https://github.com/postcss/postcss-custom-media PostCSS plugin to the style pipeline and imports the default breakpoints from https://tailwindcss.com/docs/responsive-design to eventually consolidate all of our existing breakpoints.
2 parents 9c4f956 + 0208829 commit 647bbce

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

app/components/settings-page.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
display: grid;
33
gap: 16px;
44

5-
@media only screen and (min-width: 891px) {
5+
@media (--min-m) {
66
grid-template:
77
"menu content" auto /
88
200px auto;

app/components/settings/api-tokens.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
border-radius: 4px;
152152
}
153153

154-
@media (min-width: 640px) {
154+
@media (--min-s) {
155155
.new-token-form {
156156
display: grid;
157157
grid-template-columns: 1fr auto;

app/styles/breakpoints.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* see https://github.com/postcss/postcss-custom-media */
2+
3+
/* breakpoints inspired by https://tailwindcss.com/docs/responsive-design */
4+
@custom-media --min-s (min-width: 640px);
5+
@custom-media --min-m (min-width: 768px);
6+
@custom-media --min-l (min-width: 1024px);
7+
@custom-media --min-xl (min-width: 1280px);
8+
@custom-media --min-xxl (min-width: 1536px);

ember-cli-build.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4+
const postcssCustomMedia = require('postcss-custom-media');
45

56
const { USE_EMBROIDER } = process.env;
67

@@ -29,6 +30,11 @@ module.exports = function (defaults) {
2930
extension: 'module.css',
3031
plugins: {
3132
before: [require('postcss-nested')],
33+
after: [
34+
postcssCustomMedia({
35+
importFrom: `${__dirname}/app/styles/breakpoints.css`,
36+
}),
37+
],
3238
},
3339
},
3440
fingerprint: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"match-json": "1.3.3",
123123
"normalize.css": "8.0.1",
124124
"nyc": "15.1.0",
125+
"postcss-custom-media": "8.0.0",
125126
"postcss-nested": "5.0.6",
126127
"prettier": "2.5.1",
127128
"qunit": "2.17.2",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11665,6 +11665,11 @@ postcss-color-rebeccapurple@^4.0.1:
1166511665
postcss "^7.0.2"
1166611666
postcss-values-parser "^2.0.0"
1166711667

11668+
postcss-custom-media@8.0.0:
11669+
version "8.0.0"
11670+
resolved "https://registry.yarnpkg.com/postcss-custom-media/-/postcss-custom-media-8.0.0.tgz#1be6aff8be7dc9bf1fe014bde3b71b92bb4552f1"
11671+
integrity sha512-FvO2GzMUaTN0t1fBULDeIvxr5IvbDXcIatt6pnJghc736nqNgsGao5NT+5+WVLAQiTt6Cb3YUms0jiPaXhL//g==
11672+
1166811673
postcss-custom-media@^7.0.8:
1166911674
version "7.0.8"
1167011675
resolved "https://registry.yarnpkg.com/postcss-custom-media/-/postcss-custom-media-7.0.8.tgz#fffd13ffeffad73621be5f387076a28b00294e0c"

0 commit comments

Comments
 (0)