Skip to content

Commit 2e49a03

Browse files
committed
localize urls in nested items
1 parent 98f6d7a commit 2e49a03

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ function localizeDeclNode(node, context) {
154154
return newNode;
155155
}
156156
break;
157+
158+
case 'nested-item':
159+
var newNodes = node.nodes.map(function(n) {
160+
return localizeDeclValue(n, context);
161+
});
162+
node = Object.create(node);
163+
node.nodes = newNodes;
164+
break;
165+
157166
case 'url':
158167
if(context.options && context.options.rewriteUrl) {
159168
newNode = Object.create(node);

test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ var tests = [
363363
input: '.a { background: url(./image.png); }\n' +
364364
':global .b { background: url(image.png); }\n' +
365365
'.c { background: url("./image.png"); }\n' +
366+
'.d { background: -webkit-image-set(url("./image.png") 1x, url("./image2x.png") 2x); }\n' +
366367
'@font-face { src: url("./font.woff"); }\n' +
367368
'@-webkit-font-face { src: url("./font.woff"); }\n' +
368369
'@media screen { .a { src: url("./image.png"); } }\n' +
@@ -377,6 +378,7 @@ var tests = [
377378
expected: ':local(.a) { background: url((local\\)./image.png\\\"local\\\"); }\n' +
378379
'.b { background: url((global\\)image.png\\\"global\\\"); }\n' +
379380
':local(.c) { background: url(\"(local)./image.png\\\"local\\\"\"); }\n' +
381+
':local(.d) { background: -webkit-image-set(url(\"(local)./image.png\\\"local\\\"\") 1x, url(\"(local)./image2x.png\\\"local\\\"\") 2x); }\n' +
380382
'@font-face { src: url(\"(local)./font.woff\\\"local\\\"\"); }\n' +
381383
'@-webkit-font-face { src: url(\"(local)./font.woff\\\"local\\\"\"); }\n' +
382384
'@media screen { :local(.a) { src: url("(local)./image.png\\"local\\""); } }\n' +

0 commit comments

Comments
 (0)