bholloway / resolve-url-loader

Webpack loader that resolves relative paths in url() statements based on the original source file
563 stars 71 forks source link

Create sourcemap-to-string package #138

Closed bholloway closed 4 years ago

bholloway commented 4 years ago

Implement #137

New package sourcemap-to-string for better test assertions.

Example output from a simple production css file with 2 sources.

feature/index.scss                                                              
--------------------------------------------------------------------------------
1:01 .some-class-name {⏎                1:001 .some-class-name{░░░░░░░░░░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2:03 ░░single-quoted: url('../images/im 1:018 ░░░░░░░░░░░░░░░░░single-quoted:url
     g.jpg')░░░░░░░░░░░░░░░░░░░░░░░░░░░       (images/img.jpg)░░░░░░░░░░░░░░░░░░
2:42 ░░░░░░░;⏎                          1:051 ░░░░░░░░░░░░░░░░;░░░░░░░░░░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
3:03 ░░double-quoted: url("../images/im 1:052 ░░░░░░░░░░░░░░░░░double-quoted:url
     g.jpg")░░░░░░░░░░░░░░░░░░░░░░░░░░░       (images/img.jpg)░░░░░░░░░░░░░░░░░░
3:42 ░░░░░░░;⏎                          1:085 ░░░░░░░░░░░░░░░░;░░░░░░░░░░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
4:03 ░░unquoted: url(../images/img.jpg) 1:086 ░░░░░░░░░░░░░░░░░unquoted:url(imag
     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       es/img.jpg)░░░░░░░░░░░░░░░░░░░░░░░
4:35 ;⏎                                 1:114 ░░░░░░░░░░░;░░░░░░░░░░░░░░░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
5:03 ░░query: url(../images/img.jpg?que 1:115 ░░░░░░░░░░░░query:url(images/img.j
     ry)░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       pg?query)░░░░░░░░░░░░░░░░░░░░░░░░░
5:38 ░░░;⏎                              1:146 ░░░░░░░░░;░░░░░░░░░░░░░░░░░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
6:03 ░░hash: url(../images/img.jpg#hash 1:147 ░░░░░░░░░░hash:url(images/img.jpg#
     )░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       hash)░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
6:36 ░;⏎                                1:176 ░░░░░}░░░░░░░░░░░░░░░░░░░░░░░░░░░░
     }░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

index.scss                                                                      
--------------------------------------------------------------------------------
2:01 .another-class-name {⏎             1:177 ░░░░░░.another-class-name{░░░░░░░░
       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
3:03 ░░display: block░░░░░░░░░░░░░░░░░░ 1:197 ░░░░░░░░░░░░░░░░░░░░░░░░░░display:
     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       block░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
3:17 ░░░░░░░░░░░░░░░░;⏎                 1:210 ░░░░░}░░░░░░░░░░░░░░░░░░░░░░░░░░░░
     }░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░