File tree 3 files changed +31
-3
lines changed
test/fixtures/remote-and-absolute
3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,28 @@ class Rebaser extends Transform {
23
23
syntax : 'css'
24
24
} ) ;
25
25
26
+ let shouldBeRebased = function ( uri ) {
27
+ if ( path . isAbsolute ( uri ) ) {
28
+ return false ;
29
+ }
30
+
31
+ let url = Url . parse ( uri ) ;
32
+
33
+ // if the url consists of only a hash, it is a reference to an id
34
+ if ( url . hash ) {
35
+ if ( ! url . path ) {
36
+ return false ;
37
+ }
38
+ }
39
+
40
+ // if the url host is set, it is a remote uri
41
+ if ( url . host ) {
42
+ return false ;
43
+ }
44
+
45
+ return true ;
46
+ } ;
47
+
26
48
if ( self . map ) {
27
49
let sourceMapConsumer = new SourceMapConsumer ( self . map ) ;
28
50
@@ -44,9 +66,7 @@ class Rebaser extends Transform {
44
66
} ) ;
45
67
46
68
if ( sourceMapNode && sourceMapNode . source ) {
47
- let url = Url . parse ( contentNodeContent ) ;
48
-
49
- if ( ! url . host && ! path . isAbsolute ( contentNodeContent ) ) {
69
+ if ( shouldBeRebased ( contentNodeContent ) ) {
50
70
contentNode . content = path . join ( path . dirname ( sourceMapNode . source ) , contentNodeContent ) ;
51
71
52
72
self . emit ( 'rebase' , contentNode . content ) ;
Original file line number Diff line number Diff line change 8
8
9
9
.foo-bar {
10
10
background : url (' http://foo/bar' );
11
+ }
12
+
13
+ .svg-id {
14
+ fill : url (#foo );
11
15
}
Original file line number Diff line number Diff line change 8
8
9
9
.foo-bar {
10
10
background : url ('http://foo/bar' );
11
+ }
12
+
13
+ .svg-id {
14
+ fill : url (# foo);
11
15
}
You can’t perform that action at this time.
0 commit comments