File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,18 @@ const promisify = require('node-promisify')
7
7
const fsWrite = promisify ( fs . writeFile )
8
8
const mkdirp = promisify ( require ( 'mkdirp' ) )
9
9
10
+ function toUrl ( localPath ) {
11
+ if ( path . sep === '\\' ) {
12
+ return localPath . replace ( / \\ / g, '\/' )
13
+ }
14
+ return localPath
15
+ }
16
+
10
17
function rebase ( result ) {
11
18
if ( result . isRelative ( ) ) {
12
- result . url = path . relative (
19
+ result . url = toUrl ( path . relative (
13
20
path . dirname ( result . to ) , result . file
14
- )
21
+ ) )
15
22
}
16
23
}
17
24
@@ -72,11 +79,11 @@ function copy(result, opts) {
72
79
. then ( function ( basename ) {
73
80
let assetFile = path . join ( assetFolder , basename )
74
81
if ( opts . baseUrl ) {
75
- result . url = path . join ( opts . baseUrl , basename )
82
+ result . url = toUrl ( path . join ( opts . baseUrl , basename ) )
76
83
} else {
77
- result . url = path . relative (
84
+ result . url = toUrl ( path . relative (
78
85
path . dirname ( result . to ) , assetFile
79
- )
86
+ ) )
80
87
}
81
88
return result . asset . data ( ) . then ( function ( buf ) {
82
89
return fsWrite ( assetFile , buf )
You can’t perform that action at this time.
0 commit comments