Skip to content

Commit 6e9dd3a

Browse files
committed
1 parent 75b1951 commit 6e9dd3a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

gulp.d/tasks/build-preview-pages.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ function relativize (to, { data: { root } }) {
126126
hash = to.slice(hashIdx)
127127
to = to.slice(0, hashIdx)
128128
}
129-
return to === from
130-
? hash || (to.charAt(to.length - 1) === '/' ? './' : path.basename(to))
131-
: (path.relative(path.dirname(from + '.'), to) || '.') + (to.charAt(to.length - 1) === '/' ? '/' + hash : hash)
129+
if (to === from) return hash || (to.charAt(to.length - 1) === '/' ? './' : path.basename(to))
130+
const rel = path.relative(path.dirname(from + '.'), to)
131+
const toDir = to.charAt(to.length - 1) === '/'
132+
return rel ? (toDir ? rel + '/' : rel) + hash : (toDir ? './' : '../' + path.basename(to)) + hash
132133
}
133134

134135
function resolvePage (spec, context = {}) {

0 commit comments

Comments
 (0)