Skip to content

Commit d54d49b

Browse files
committed
unroll the local(--name) once we extract the export
1 parent 19245d9 commit d54d49b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {
141141
} else if (atrule.name === "custom-media") {
142142
var customMedia = /^\s*local\(([^\)]+)\)\s*(.*)$/.exec(atrule.params);
143143
if(customMedia) {
144-
exports[customMedia[1]] = [`"${customMedia[2]}"`];
144+
let [/*match*/, breakpointName, mediaExpr] = customMedia;
145+
exports[breakpointName] = [`"${ mediaExpr}"`];
146+
atrule.params = `${breakpointName} ${mediaExpr}`;
145147
}
146148
}
147149
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@custom-media local(--small) (max-width: 30rem);
1+
@custom-media --small (max-width: 30rem);
22
:export{
33
--small: "(max-width: 30rem)"
44
}

0 commit comments

Comments
 (0)