File tree Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,13 @@ const plugin = (options = {}) => tree => {
132132
133133 parsed . map ( p => {
134134 if ( ! isUrl ( p . url ) ) {
135- p . url = typeof value === 'boolean' ? options . url + p . url : value + p . url
135+ p . url = typeof value === 'boolean'
136+ ? isUrl ( options . url )
137+ ? options . url + p . url
138+ : path . join ( options . url , p . url )
139+ : isUrl ( value )
140+ ? value + p . url
141+ : path . join ( value , p . url )
136142 }
137143
138144 return p
Original file line number Diff line number Diff line change 1- < img src ="https://example.com/image1.jpg " srcset ="https://example.com/image1-HD.jpg 2x, https://example.com/image1-phone.jpg 100w ">
2-
1+ < img src ="images/image1.jpg " srcset ="images/image1-HD.jpg 2x, images/image1-phone.jpg 100w ">
32< img src ="https://example.com/image2.jpg " srcset ="https://example.com/image2-HD.jpg 2x, https://example.com/image2-phone.jpg 100w ">
4-
53< picture >
6- < source media ="(max-width: 799px) " srcset ="https://example.com /elva-480w-close-portrait.jpg ">
7- < source media ="(min-width: 800px) " srcset ="https://example.com /elva-800w.jpg ">
8- < img src ="https://example.com /elva-800w.jpg " alt ="... ">
4+ < source media ="(max-width: 799px) " srcset ="images /elva-480w-close-portrait.jpg ">
5+ < source media ="(min-width: 800px) " srcset ="images /elva-800w.jpg ">
6+ < img src ="images /elva-800w.jpg " alt ="... ">
97</ picture >
Original file line number Diff line number Diff line change 11< img src ="image1.jpg " srcset ="image1-HD.jpg 2x,image1-phone.jpg 100w ">
2-
32< img src ="https://example.com/image2.jpg " srcset ="https://example.com/image2-HD.jpg 2x, https://example.com/image2-phone.jpg 100w ">
4-
53< picture >
64 < source media ="(max-width: 799px) " srcset ="elva-480w-close-portrait.jpg ">
75 < source media ="(min-width: 800px) " srcset ="elva-800w.jpg ">
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ test('src attribute', t => {
4949
5050test ( 'srcset attribute' , t => {
5151 return process ( t , 'srcset' , {
52- url : 'https://example.com/ ' ,
52+ url : 'images ' ,
5353 allTags : true ,
5454 } )
5555} )
You can’t perform that action at this time.
0 commit comments