diff --git a/lib/index-html.js b/lib/index-html.js index 132b29a..d19cc96 100644 --- a/lib/index-html.js +++ b/lib/index-html.js @@ -2,7 +2,7 @@ function indexHtml (opts) { return (hasTrailingSlash) => { - const prefix = hasTrailingSlash ? `.${opts.staticPrefix}` : `.${opts.prefix}${opts.staticPrefix}` + const prefix = hasTrailingSlash ? `.${opts.staticPrefix}` : `${opts.prefix}${opts.staticPrefix}` return ` diff --git a/test/route.test.js b/test/route.test.js index 5664f36..86d9b31 100644 --- a/test/route.test.js +++ b/test/route.test.js @@ -548,10 +548,10 @@ test('/documentation should display index html with correct asset urls', async ( url: '/documentation' }) - t.equal(res.payload.includes('href="./documentation/static/index.css"'), true) - t.equal(res.payload.includes('src="./documentation/static/theme/theme-js.js"'), true) - t.equal(res.payload.includes('href="./documentation/index.css"'), false) - t.equal(res.payload.includes('src="./documentation/theme/theme-js.js"'), false) + t.equal(res.payload.includes('href="/documentation/static/index.css"'), true) + t.equal(res.payload.includes('src="/documentation/static/theme/theme-js.js"'), true) + t.equal(res.payload.includes('href="/documentation/index.css"'), false) + t.equal(res.payload.includes('src="/documentation/theme/theme-js.js"'), false) }) test('/documentation/ should display index html with correct asset urls', async (t) => { @@ -582,10 +582,10 @@ test('/docs should display index html with correct asset urls when documentation url: '/docs' }) - t.equal(res.payload.includes('href="./docs/static/index.css"'), true) - t.equal(res.payload.includes('src="./docs/static/theme/theme-js.js"'), true) - t.equal(res.payload.includes('href="./docs/index.css"'), false) - t.equal(res.payload.includes('src="./docs/theme/theme-js.js"'), false) + t.equal(res.payload.includes('href="/docs/static/index.css"'), true) + t.equal(res.payload.includes('src="/docs/static/theme/theme-js.js"'), true) + t.equal(res.payload.includes('href="/docs/index.css"'), false) + t.equal(res.payload.includes('src="/docs/theme/theme-js.js"'), false) }) test('/docs/ should display index html with correct asset urls when documentation prefix is set', async (t) => {