Skip to content

Commit

Permalink
Export: do not create subdirectories for links ending with .html - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NOtherDev committed Jan 8, 2020
1 parent 636739f commit 614da0b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function _export({
const is_html = type === 'text/html';

if (is_html) {
if (pathname !== '/service-worker-index.html') {
if (pathname !== '/service-worker-index.html' && !file.endsWith('.html')) {
file = file === '' ? 'index.html' : `${file}/index.html`;
}
body = minify_html(body);
Expand Down
12 changes: 12 additions & 0 deletions test/apps/export/src/routes/boom/[a]/[b].html.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script context="module">
export function preload({ params }) {
return params;
}
</script>

<script>
export let a;
export let b;
</script>

<p>{a}/{b}.html</p>
1 change: 1 addition & 0 deletions test/apps/export/src/routes/boom/[a]/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

{#each list as b}
<a href="boom/{a}/{b}">{a}/{b}</a>
<a href="boom/{a}/{b}.html">{a}/{b}.html</a>
{/each}
3 changes: 2 additions & 1 deletion test/apps/export/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('export', function() {
for (let a = 1; a <= 20; a += 1) {
boom.push(`boom/${a}/index.html`);
for (let b = 1; b <= 20; b += 1) {
boom.push(`boom/${a}/${b}/index.html`);
boom.push(`boom/${a}/${b}.html`);
boom.push(`boom/${a}/${b}/index.html`);
}
}

Expand Down

0 comments on commit 614da0b

Please sign in to comment.