Skip to content

Commit 80abf64

Browse files
committed
simple transitivity
1 parent c126495 commit 80abf64

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ exports['default'] = function (css) {
3939
var /*match*/key = _matches2[1];
4040
var value = _matches2[2];
4141

42+
// Values can refer to each other
43+
if (definitions[value]) value = definitions[value];
4244
definitions[key] = value;
4345
atRule.remove();
4446
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export default css => {
1616
let matches
1717
while (matches = matchLet.exec(atRule.params)) {
1818
let [/*match*/, key, value] = matches
19+
// Values can refer to each other
20+
if (definitions[value]) value = definitions[value]
1921
definitions[key] = value
2022
atRule.remove()
2123
}

test/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,12 @@ describe('constants', () => {
7171
':import(colors) {\n i__const_red_6: red\n}'
7272
)
7373
})
74+
75+
it('should allow transitive values', () => {
76+
test(
77+
'@value aaa: red;\n@value bbb: aaa;\n.a { color: bbb; }',
78+
':export {\n aaa: red;\n bbb: red;\n}\n.a { color: red; }'
79+
)
80+
})
7481
})
7582

0 commit comments

Comments
 (0)