Skip to content

Commit 5c78b4f

Browse files
committedJan 30, 2018
Fix regression, replace values in media queries, closes #24
1 parent 4da3fe9 commit 5c78b4f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎index.js

+3
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ const factory = ({ fs = nodeFs, resolve: options = {} } = {}) => async (root, ro
157157
if (node.type === 'decl') {
158158
// eslint-disable-next-line no-param-reassign
159159
node.value = replaceValueSymbols(node.value, definitions);
160+
} else if (node.type === 'atrule' && node.name === 'media') {
161+
// eslint-disable-next-line no-param-reassign
162+
node.params = replaceValueSymbols(node.params, definitions);
160163
}
161164
});
162165
};

‎test.js

+8
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ test('should replace inside custom properties', async (t) => {
239239
);
240240
});
241241

242+
test('should replace inside media queries', async (t) => {
243+
await run(
244+
t,
245+
'@value base: 10px;\n@media (min-width: calc(base * 200)) {}',
246+
'@value base: 10px;\n@media (min-width: calc(10px * 200)) {}',
247+
);
248+
});
249+
242250
test('should allow custom-property-style names', async (t) => {
243251
await run(
244252
t,

0 commit comments

Comments
 (0)
Please sign in to comment.