Skip to content
This repository was archived by the owner on Jun 6, 2022. It is now read-only.

Commit 5db224c

Browse files
committed
7.0.7
1 parent f095211 commit 5db224c

10 files changed

+70
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changes to PostCSS Custom Media
22

3+
### 7.0.7 (October 19, 2018)
4+
5+
- Fixed: Issue combining custom media media queries with `and`
6+
37
### 7.0.6 (October 12, 2018)
48

5-
- Fixing: Issue combining multiple custom media
9+
- Fixed: Issue combining multiple custom media
610

711
### 7.0.5 (October 5, 2018)
812

lib/transform-media-list.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ function transformMedia(media, customMedias) {
4949

5050
mediaClone.nodes.splice(index, 1, ...replacementMedia.clone().nodes.map(node => {
5151
// use raws and spacing from the current usage
52-
node.raws = { ...media.nodes[index].raws };
52+
if (media.nodes[index].raws.and) {
53+
node.raws = { ...media.nodes[index].raws };
54+
}
55+
5356
node.spaces = { ...media.nodes[index].spaces };
5457

5558
return node;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-custom-media",
3-
"version": "7.0.6",
3+
"version": "7.0.7",
44
"description": "Use Custom Media Queries in CSS",
55
"author": "Jonathan Neal <[email protected]>",
66
"contributors": [
@@ -34,7 +34,7 @@
3434
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
3535
"@babel/preset-env": "^7.1.0",
3636
"babel-eslint": "^10.0.1",
37-
"eslint": "^5.6.1",
37+
"eslint": "^5.7.0",
3838
"eslint-config-dev": "^2.0.0",
3939
"postcss-tape": "^2.2.0",
4040
"pre-commit": "^1.2.2",

test/basic.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,17 @@
6767
order: 6;
6868
}
6969
}
70+
71+
@custom-media --concat (min-width: 320px) and (max-width: 640px);
72+
73+
@media (--concat) {
74+
body {
75+
order: 7;
76+
}
77+
}
78+
79+
@media (--concat) and (min-aspect-ratio: 16/9) {
80+
body {
81+
order: 8;
82+
}
83+
}

test/basic.expect.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,15 @@
5757
order: 6;
5858
}
5959
}
60+
61+
@media (min-width: 320px) and (max-width: 640px) {
62+
body {
63+
order: 7;
64+
}
65+
}
66+
67+
@media (min-width: 320px) and (max-width: 640px) and (min-aspect-ratio: 16/9) {
68+
body {
69+
order: 8;
70+
}
71+
}

test/basic.preserve.expect.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,29 @@
127127
order: 6;
128128
}
129129
}
130+
131+
@custom-media --concat (min-width: 320px) and (max-width: 640px);
132+
133+
@media (min-width: 320px) and (max-width: 640px) {
134+
body {
135+
order: 7;
136+
}
137+
}
138+
139+
@media (--concat) {
140+
body {
141+
order: 7;
142+
}
143+
}
144+
145+
@media (min-width: 320px) and (max-width: 640px) and (min-aspect-ratio: 16/9) {
146+
body {
147+
order: 8;
148+
}
149+
}
150+
151+
@media (--concat) and (min-aspect-ratio: 16/9) {
152+
body {
153+
order: 8;
154+
}
155+
}

test/export-media.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
@custom-media --circular-mq-b (--circular-mq-a);
66
@custom-media --min (min-width: 320px);
77
@custom-media --max (max-width: 640px);
8+
@custom-media --concat (min-width: 320px) and (max-width: 640px);

test/export-media.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
'--circular-mq-a': '(--circular-mq-b)',
77
'--circular-mq-b': '(--circular-mq-a)',
88
'--min': '(min-width: 320px)',
9-
'--max': '(max-width: 640px)'
9+
'--max': '(max-width: 640px)',
10+
'--concat': '(min-width: 320px) and (max-width: 640px)'
1011
}
1112
};

test/export-media.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"--circular-mq-a": "(--circular-mq-b)",
77
"--circular-mq-b": "(--circular-mq-a)",
88
"--min": "(min-width: 320px)",
9-
"--max": "(max-width: 640px)"
9+
"--max": "(max-width: 640px)",
10+
"--concat": "(min-width: 320px) and (max-width: 640px)"
1011
}
1112
}

test/export-media.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const customMedia = {
55
'--circular-mq-a': '(--circular-mq-b)',
66
'--circular-mq-b': '(--circular-mq-a)',
77
'--min': '(min-width: 320px)',
8-
'--max': '(max-width: 640px)'
8+
'--max': '(max-width: 640px)',
9+
'--concat': '(min-width: 320px) and (max-width: 640px)'
910
};

0 commit comments

Comments
 (0)